The Horde_Perms_Base class provides the Horde permissions system.
Copyright 2001-2012 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.
Methods summary
public
|
#
__construct( array $params = array() )
Constructor.
Parameters
- $params
- Configuration parameters:
<pre><span class="php-quote">'cache'</span> - (Horde_Cache) The object to <span class="php-keyword1">use</span> to cache perms.
<span class="php-quote">'logger'</span> - (Horde_Log_Logger) A logger object.</pre>
Throws
|
public
string
|
#
getShortName( string $name )
Returns the short name of an object, the last portion of the full name.
Returns the short name of an object, the last portion of the full name.
Parameters
- $name
- The name of the object.
Returns
string The object's short name.
|
abstract public
Horde_Perms_Permission
|
#
newPermission( string $name, string $type = 'matrix', array $params = null )
Returns a new permissions object.
Returns a new permissions object.
Parameters
- $name
- The permission's name.
- $type
- The permission type.
- $params
- The permission parameters.
Returns
Throws
|
abstract public
Horde_Perms_Permission
|
#
getPermission( string $name )
Returns an object corresponding to the named permission, with the users
and other data retrieved appropriately.
Returns an object corresponding to the named permission, with the users
and other data retrieved appropriately.
Parameters
- $name
- The name of the permission to retrieve.
Returns
Throws
|
abstract public
Horde_Perms_Permission
|
#
getPermissionById( integer $cid )
Returns an object corresponding to the given unique ID, with the users
and other data retrieved appropriately.
Returns an object corresponding to the given unique ID, with the users
and other data retrieved appropriately.
Parameters
- $cid
- The unique ID of the permission to retrieve.
Returns
Throws
|
abstract public
|
#
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.
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.
Parameters
- $perm
- The permissions object.
Throws
|
abstract public
|
#
removePermission( Horde_Perms_Permission $perm, boolean $force = false )
Removes a permission from the permissions system permanently.
Removes a permission from the permissions system permanently.
Parameters
- $perm
- The permission to remove.
- $force
- Force to remove every child.
Throws
|
public
mixed
|
#
getPermissions( mixed $permission, string $user, string $creator = null )
Finds out what rights the given user has to this object.
Finds out what rights the given user has to this object.
Parameters
- $permission
- <p>The full permission name of the object to
check the permissions of, or the
Horde_Permissions object.</p>
- $user
- The user to check for.
- $creator
- The user who created the event.
Returns
mixed A bitmask of permissions the user has, false if there
are none.
|
abstract public
integer
|
#
getPermissionId( Horde_Perms_Permission $permission )
Returns the unique identifier of this permission.
Returns the unique identifier of this permission.
Parameters
- $permission
- <p>The permission object to get
the ID of.</p>
Returns
integer The unique id.
Throws
|
public
boolean
|
#
hasPermission( string $permission, string $user, integer $perm, string $creator = null )
Finds out if the user has the specified rights to the given object.
Finds out if the user has the specified rights to the given object.
Parameters
- $permission
- The permission to check.
- $user
- The user to check for.
- $perm
- <p>The permission level that needs to be checked
for.</p>
- $creator
- The creator of the event
Returns
boolean Whether the user has the specified permissions.
|
abstract public
boolean
|
#
exists( string $permission )
Checks if a permission exists in the system.
Checks if a permission exists in the system.
Parameters
- $permission
- The permission to check.
Returns
boolean True if the permission exists.
|
abstract public
array
|
#
getParents( string $child )
Returns a list of parent permissions.
Returns a list of parent permissions.
Parameters
- $child
- The name of the child to retrieve parents for.
Returns
array A hash with all parents in a tree format.
Throws
|
abstract public
array
|
#
getTree( )
Returns all permissions of the system in a tree format.
Returns all permissions of the system in a tree format.
Returns
array A hash with all permissions in a tree format.
|