Horde_Perms_Permission::getUserPermissions PHP Method

getUserPermissions() public method

Returns an array of all user permissions on this object.
public getUserPermissions ( integer $perm = null ) : array
$perm integer List only users with this permission level. Defaults to all users.
return array All user permissions for this object, indexed by user.
    public function getUserPermissions($perm = null)
    {
        if (!isset($this->data['users']) || !is_array($this->data['users'])) {
            return array();
        } elseif (!$perm) {
            return $this->data['users'];
        }
        $users = array();
        foreach ($this->data['users'] as $user => $uperm) {
            if ($uperm & $perm) {
                $users[$user] = $uperm;
            }
        }
        return $users;
    }

Usage Example

示例#1
0
文件: Kolab.php 项目: raz0rsdge/horde
 /**
  * Returns an array of all user permissions on this object.
  *
  * @param integer $perm  List only users with this permission level.
  *                       Defaults to all users.
  *
  * @return array  All user permissions for this object, indexed by user.
  */
 public function getUserPermissions($perm = null)
 {
     $users = parent::getUserPermissions($perm);
     unset($users[$this->_storage->getOwner()]);
     return $users;
 }