PHP Class Horde_Perms_Sql, horde

Copyright 2008-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: Duck ([email protected])
Inheritance: extends Horde_Perms_Base
Mostra file Open project: horde/horde

Protected Properties

Property Type Description
$_db Horde_Db_Adapter Handle for the current database connection.
$_params array Configuration parameters.
$_permsCache array Cache of previously retrieved permissions.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
addPermission ( Horde_Perms_Permission $perm ) : integer 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.
getParent ( mixed $child ) : integer Returns a child's direct parent ID.
getParents ( string $child ) : array Returns a list of parent permissions.
getPermission ( string $name ) : Horde_Perms_Permission_Sql Returns an object corresponding to the named permission, with the users and other data retrieved appropriately.
getPermissionById ( integer $id ) : Horde_Perms_Permission_Sql Returns a permission object corresponding to the given unique ID, with the users and other data retrieved appropriately.
getPermissionId ( $permission ) : integer Returns the unique identifier of this permission.
getTree ( ) : array Returns all permissions of the system in a tree format.
newPermission ( string $name, string $type = 'matrix', array $params = null ) : Horde_Perms_Permission_Sql Returns a new permissions object.
removePermission ( Horde_Perms_Permission $perm, boolean $force = false ) : boolean Removes a permission from the permissions system permanently.

Protected Methods

Method Description
_getParents ( $parents ) TODO

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters (in addition to base Horde_Perms parameters):
'db' - (Horde_Db_Adapter) [REQUIRED] The DB instance.
'table' - (string) The name of the perms table.
          DEFAULT: 'horde_perms'

_getParents() protected method

TODO
protected _getParents ( $parents )

addPermission() 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.
public addPermission ( Horde_Perms_Permission $perm ) : integer
$perm Horde_Perms_Permission The perm object.
return integer Permission ID in the database.

exists() public method

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

getParent() public method

Returns a child's direct parent ID.
public getParent ( mixed $child ) : integer
$child mixed The object name for which to look up the parent's ID.
return integer The unique ID of the parent.

getParents() public method

Returns a list of parent permissions.
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() public method

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

getPermissionById() public method

Returns a permission object corresponding to the given unique ID, with the users and other data retrieved appropriately.
public getPermissionById ( integer $id ) : Horde_Perms_Permission_Sql
$id integer The unique ID of the permission to retrieve.
return Horde_Perms_Permission_Sql TODO

getPermissionId() public method

Returns the unique identifier of this permission.
public getPermissionId ( $permission ) : integer
return integer The unique id.

getTree() public method

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

newPermission() public method

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

removePermission() public method

Removes a permission from the permissions system permanently.
public removePermission ( Horde_Perms_Permission $perm, boolean $force = false ) : boolean
$perm Horde_Perms_Permission The permission to remove.
$force boolean Force to remove every child.
return boolean True if permission was deleted.

Property Details

$_db protected_oe property

Handle for the current database connection.
protected Horde_Db_Adapter $_db
return Horde_Db_Adapter

$_params protected_oe property

Configuration parameters.
protected array $_params
return array

$_permsCache protected_oe property

Cache of previously retrieved permissions.
protected array $_permsCache
return array