PHP Class Horde_Perms_Base, horde

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 ([email protected])
Author: Jan Schneider ([email protected])
Mostra file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_cache Horde_Cache Cache object.
$_logger Horde_Log_Logger Logger.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
addPermission ( Horde_Perms_Permission $perm ) Adds a permission to the permissions system. The permission must first be created with newPermission(), and have any initial users added to it, before this function is called.
exists ( string $permission ) : boolean Checks if a permission exists in the system.
getParents ( string $child ) : array Returns a list of parent permissions.
getPermission ( string $name ) : Horde_Perms_Permission Returns an object corresponding to the named permission, with the users and other data retrieved appropriately.
getPermissionById ( integer $cid ) : Horde_Perms_Permission Returns an object corresponding to the given unique ID, with the users and other data retrieved appropriately.
getPermissionId ( Horde_Perms_Permission $permission ) : integer Returns the unique identifier of this permission.
getPermissions ( mixed $permission, string $user, string $creator = null ) : mixed Finds out what rights the given user has to this object.
getShortName ( string $name ) : string Returns the short name of an object, the last portion of the full name.
getTree ( ) : array Returns all permissions of the system in a tree format.
hasPermission ( string $permission, string $user, integer $perm, string $creator = null ) : boolean Finds out if the user has the specified rights to the given object.
newPermission ( string $name, string $type = 'matrix', array $params = null ) : Horde_Perms_Permission Returns a new permissions object.
removePermission ( Horde_Perms_Permission $perm, boolean $force = false ) Removes a permission from the permissions system permanently.

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters:
'cache' - (Horde_Cache) The object to use to cache perms.
'logger' - (Horde_Log_Logger) A logger object.

addPermission() abstract public method

Adds a permission to the permissions system. The permission must first be created with newPermission(), and have any initial users added to it, before this function is called.
abstract public addPermission ( Horde_Perms_Permission $perm )
$perm Horde_Perms_Permission The permissions object.

exists() abstract public method

Checks if a permission exists in the system.
abstract public exists ( string $permission ) : boolean
$permission string The permission to check.
return boolean True if the permission exists.

getParents() abstract public method

Returns a list of parent permissions.
abstract public getParents ( string $child ) : array
$child string The name of the child to retrieve parents for.
return array A hash with all parents in a tree format.

getPermission() abstract public method

Returns an object corresponding to the named permission, with the users and other data retrieved appropriately.
abstract public getPermission ( string $name ) : Horde_Perms_Permission
$name string The name of the permission to retrieve.
return Horde_Perms_Permission A permissions object.

getPermissionById() abstract public method

Returns an object corresponding to the given unique ID, with the users and other data retrieved appropriately.
abstract public getPermissionById ( integer $cid ) : Horde_Perms_Permission
$cid integer The unique ID of the permission to retrieve.
return Horde_Perms_Permission A permissions object.

getPermissionId() abstract public method

Returns the unique identifier of this permission.
abstract public getPermissionId ( Horde_Perms_Permission $permission ) : integer
$permission Horde_Perms_Permission The permission object to get the ID of.
return integer The unique id.

getPermissions() public method

Finds out what rights the given user has to this object.
public getPermissions ( mixed $permission, string $user, string $creator = null ) : mixed
$permission mixed The full permission name of the object to check the permissions of, or the Horde_Permissions object.
$user string The user to check for.
$creator string The user who created the event.
return mixed A bitmask of permissions the user has, false if there are none.

getShortName() public method

Returns the short name of an object, the last portion of the full name.
public getShortName ( string $name ) : string
$name string The name of the object.
return string The object's short name.

getTree() abstract public method

Returns all permissions of the system in a tree format.
abstract public getTree ( ) : array
return array A hash with all permissions in a tree format.

hasPermission() public method

Finds out if the user has the specified rights to the given object.
public hasPermission ( string $permission, string $user, integer $perm, string $creator = null ) : boolean
$permission string The permission to check.
$user string The user to check for.
$perm integer The permission level that needs to be checked for.
$creator string The creator of the event
return boolean Whether the user has the specified permissions.

newPermission() abstract public method

Returns a new permissions object.
abstract public newPermission ( string $name, string $type = 'matrix', array $params = null ) : Horde_Perms_Permission
$name string The permission's name.
$type string The permission type.
$params array The permission parameters.
return Horde_Perms_Permission A new permissions object.

removePermission() abstract public method

Removes a permission from the permissions system permanently.
abstract public removePermission ( Horde_Perms_Permission $perm, boolean $force = false )
$perm Horde_Perms_Permission The permission to remove.
$force boolean Force to remove every child.

Property Details

$_cache protected_oe property

Cache object.
protected Horde_Cache $_cache
return Horde_Cache

$_logger protected_oe property

Logger.
protected Horde_Log_Logger $_logger
return Horde_Log_Logger