/usr/share/php/Horde/Perms.php is in php-horde-perms 2.1.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | <?php
/**
* The Horde_Perms package provides the Horde permissions system.
*
* Copyright 2001-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @package Perms
*/
class Horde_Perms
{
/**
* Existence of object is known - object is shown to user.
*/
const SHOW = 2;
/**
* Contents of the object can be read.
*/
const READ = 4;
/**
* Contents of the object can be edited.
*/
const EDIT = 8;
/**
* The object can be deleted.
*/
const DELETE = 16;
/**
* A bitmask of all possible permission values.
*
* Useful for removeXxxPermission(), unsetPerm(), etc.
* 30 = SHOW | READ | EDIT | DELETE
*/
const ALL = 30;
/**
* The root permission.
*/
const ROOT = -1;
/**
* Cache for integerToArray().
*
* @var array
*/
protected static $_itaCache = array();
/**
* Returns an hash of the available permissions.
*
* @return array The available permissions as a hash.
*/
public static function getPermsArray()
{
return array(
self::SHOW => Horde_Perms_Translation::t("Show"),
self::READ => Horde_Perms_Translation::t("Read"),
self::EDIT => Horde_Perms_Translation::t("Edit"),
self::DELETE => Horde_Perms_Translation::t("Delete")
);
}
/**
* Given an integer value of permissions returns an array representation
* of the integer.
*
* @param integer $int The integer representation of permissions.
*
* @return TODO
*/
public static function integerToArray($int)
{
if (isset(self::$_itaCache[$int])) {
return self::$_itaCache[$int];
}
self::$_itaCache[$int] = array();
/* Get the available perms array. */
$perms = self::getPermsArray();
/* Loop through each perm and check if its value is included in the
* integer representation. */
foreach ($perms as $val => $label) {
if ($int & $val) {
self::$_itaCache[$int][$val] = true;
}
}
return self::$_itaCache[$int];
}
}
|