Documentation

Horde_Perms_Sql extends Horde_Perms_Base
in package

The Horde_Perms_Sql:: class provides a SQL driver for the Horde permissions system.

Copyright 2008-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.

Tags
author

Duck duck@obala.net

category

Horde

Table of Contents

$_cache  : Horde_Cache
Cache object.
$_db  : Horde_Db_Adapter
Handle for the current database connection.
$_logger  : Horde_Log_Logger
Logger.
$_params  : array<string|int, mixed>
Configuration parameters.
$_permsCache  : array<string|int, mixed>
Cache of previously retrieved permissions.
$_cacheVersion  : int
Incrementing version number if cached classes change.
__construct()  : mixed
Constructor.
addPermission()  : int
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()  : bool
Checks if a permission exists in the system.
getParent()  : int
Returns a child's direct parent ID.
getParents()  : array<string|int, mixed>
Returns a list of parent permissions.
getPermission()  : Horde_Perms_Permission_Sql
Returns an object corresponding to the named permission, with the users and other data retrieved appropriately.
getPermissionById()  : Horde_Perms_Permission_Sql
Returns a permission object corresponding to the given unique ID, with the users and other data retrieved appropriately.
getPermissionId()  : int
Returns the unique identifier of this permission.
getPermissions()  : mixed
Finds out what rights the given user has to this object.
getShortName()  : string
Returns the short name of an object, the last portion of the full name.
getTree()  : array<string|int, mixed>
Returns all permissions of the system in a tree format.
hasPermission()  : bool
Finds out if the user has the specified rights to the given object.
newPermission()  : Horde_Perms_Permission_Sql
Returns a new permissions object.
removePermission()  : bool
Removes a permission from the permissions system permanently.
_getParents()  : mixed
TODO

Properties

$_cache

Cache object.

protected Horde_Cache $_cache

$_db

Handle for the current database connection.

protected Horde_Db_Adapter $_db

$_logger

Logger.

protected Horde_Log_Logger $_logger

$_params

Configuration parameters.

protected array<string|int, mixed> $_params = array()

$_permsCache

Cache of previously retrieved permissions.

protected array<string|int, mixed> $_permsCache = array()

$_cacheVersion

Incrementing version number if cached classes change.

private int $_cacheVersion = 2

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = 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'
Tags
throws
Horde_Perms_Exception
Return values
mixed

addPermission()

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_Sql $perm) : int
Parameters
$perm : Horde_Perms_Permission_Sql

The perm object.

Tags
throws
Horde_Perms_Exception
Return values
int

Permission ID in the database.

exists()

Checks if a permission exists in the system.

public exists(string $permission) : bool
Parameters
$permission : string

The permission to check.

Tags
throws
Horde_Perms_Exception
Return values
bool

True if the permission exists.

getParent()

Returns a child's direct parent ID.

public getParent(mixed $child) : int
Parameters
$child : mixed

The object name for which to look up the parent's ID.

Tags
throws
Horde_Perms_Exception
Return values
int

The unique ID of the parent.

getParents()

Returns a list of parent permissions.

public getParents(string $child) : array<string|int, mixed>
Parameters
$child : string

The name of the child to retrieve parents for.

Tags
throws
Horde_Perms_Exception
Return values
array<string|int, mixed>

A hash with all parents in a tree format.

getPermissionId()

Returns the unique identifier of this permission.

public getPermissionId(mixed $permission) : int
Parameters
$permission : mixed

The permission object to get the ID of.

Tags
throws
Horde_Perms_Exception
Return values
int

The unique id.

getPermissions()

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

public getPermissions(mixed $permission, string $user[, string $creator = null ]) : mixed
Parameters
$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 = null

The user who created the event.

Return values
mixed

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

getShortName()

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

public getShortName(string $name) : string
Parameters
$name : string

The name of the object.

Return values
string

The object's short name.

getTree()

Returns all permissions of the system in a tree format.

public getTree() : array<string|int, mixed>
Tags
throws
Horde_Perms_Exception
Return values
array<string|int, mixed>

A hash with all permissions in a tree format.

hasPermission()

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

public hasPermission(string $permission, string $user, int $perm[, string $creator = null ]) : bool
Parameters
$permission : string

The permission to check.

$user : string

The user to check for.

$perm : int

The permission level that needs to be checked for.

$creator : string = null

The creator of the event

Return values
bool

Whether the user has the specified permissions.

newPermission()

Returns a new permissions object.

public newPermission(string $name[, string $type = 'matrix' ][, array<string|int, mixed> $params = null ]) : Horde_Perms_Permission_Sql
Parameters
$name : string

The permission's name.

$type : string = 'matrix'

The permission type.

$params : array<string|int, mixed> = null

The permission parameters.

Return values
Horde_Perms_Permission_Sql

A new permissions object.

_getParents()

TODO

protected _getParents(mixed $parents) : mixed
Parameters
$parents : mixed
Return values
mixed

Search results