\Horde_Perms_Base

The Horde_Perms_Base class provides the Horde permissions system.

Copyright 2001-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
getShortName()
newPermission()
getPermission()
getPermissionById()
addPermission()
removePermission()
getPermissions()
getPermissionId()
hasPermission()
exists()
getParents()
getTree()
No public properties found
No constants found
No protected methods found
$_cache
$_logger
N/A
No private methods found
No private properties found
N/A

Properties

$_cache

$_cache : \Horde_Cache

Cache object.

Type

\Horde_Cache

$_logger

$_logger : \Horde_Log_Logger

Logger.

Type

\Horde_Log_Logger

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Configuration parameters:

'cache' - (Horde_Cache) The object to use to cache perms.
'logger' - (Horde_Log_Logger) A logger object.

Throws

\Horde_Perms_Exception

getShortName()

getShortName(string  $name) : string

Returns the short name of an object, the last portion of the full name.

Parameters

string $name

The name of the object.

Returns

string —

The object's short name.

newPermission()

newPermission(string  $name, string  $type = 'matrix', array  $params = null) : \Horde_Perms_Permission

Returns a new permissions object.

Parameters

string $name

The permission's name.

string $type

The permission type.

array $params

The permission parameters.

Throws

\Horde_Perms_Exception

Returns

\Horde_Perms_Permission

A new permissions object.

getPermission()

getPermission(string  $name) : \Horde_Perms_Permission

Returns an object corresponding to the named permission, with the users and other data retrieved appropriately.

Parameters

string $name

The name of the permission to retrieve.

Throws

\Horde_Perms_Exception

Returns

\Horde_Perms_Permission

A permissions object.

getPermissionById()

getPermissionById(integer  $cid) : \Horde_Perms_Permission

Returns an object corresponding to the given unique ID, with the users and other data retrieved appropriately.

Parameters

integer $cid

The unique ID of the permission to retrieve.

Throws

\Horde_Perms_Exception

Returns

\Horde_Perms_Permission

A permissions object.

addPermission()

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.

Parameters

\Horde_Perms_Permission $perm

The permissions object.

Throws

\Horde_Perms_Exception

removePermission()

removePermission(\Horde_Perms_Permission  $perm, boolean  $force = false) 

Removes a permission from the permissions system permanently.

Parameters

\Horde_Perms_Permission $perm

The permission to remove.

boolean $force

Force to remove every child.

Throws

\Horde_Perms_Exception

getPermissions()

getPermissions(mixed  $permission, string  $user, string  $creator = null) : mixed

Finds out what rights the given user has to this object.

Parameters

mixed $permission

The full permission name of the object to check the permissions of, or the Horde_Permissions object.

string $user

The user to check for.

string $creator

The user who created the event.

Returns

mixed —

A bitmask of permissions the user has, false if there are none.

getPermissionId()

getPermissionId(\Horde_Perms_Permission  $permission) : integer

Returns the unique identifier of this permission.

Parameters

\Horde_Perms_Permission $permission

The permission object to get the ID of.

Throws

\Horde_Perms_Exception

Returns

integer —

The unique id.

hasPermission()

hasPermission(string  $permission, string  $user, integer  $perm, string  $creator = null) : boolean

Finds out if the user has the specified rights to the given object.

Parameters

string $permission

The permission to check.

string $user

The user to check for.

integer $perm

The permission level that needs to be checked for.

string $creator

The creator of the event

Returns

boolean —

Whether the user has the specified permissions.

exists()

exists(string  $permission) : boolean

Checks if a permission exists in the system.

Parameters

string $permission

The permission to check.

Returns

boolean —

True if the permission exists.

getParents()

getParents(string  $child) : array

Returns a list of parent permissions.

Parameters

string $child

The name of the child to retrieve parents for.

Throws

\Horde_Perms_Exception

Returns

array —

A hash with all parents in a tree format.

getTree()

getTree() : array

Returns all permissions of the system in a tree format.

Returns

array —

A hash with all permissions in a tree format.