\Horde_Perms_Permission_Sql

Extension of the Horde_Permission class for storing permission information in the SQL driver.

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.

Summary

Methods
Properties
Constants
__construct()
setCacheVersion()
get()
getName()
setName()
getData()
setData()
updatePermissions()
setPerm()
unsetPerm()
addUserPermission()
addGuestPermission()
addCreatorPermission()
addDefaultPermission()
addGroupPermission()
removeUserPermission()
removeGuestPermission()
removeCreatorPermission()
removeDefaultPermission()
removeGroupPermission()
getUserPermissions()
getGuestPermissions()
getCreatorPermissions()
getDefaultPermissions()
getGroupPermissions()
save()
__sleep()
setObs()
getId()
setId()
$data
$name
No constants found
No protected methods found
$_cacheVersion
$_id
$_cache
$_db
N/A
No private methods found
No private properties found
N/A

Properties

$data

$data : 

TODO

Type

$name

$name : 

TODO

Type

$_cacheVersion

$_cacheVersion : integer

Incrementing version number if cached classes change.

Type

integer

$_id

$_id : string

The string permission id.

Type

string

$_cache

$_cache : \Horde_Cache

Cache object.

Type

\Horde_Cache

$_db

$_db : \Horde_Db_Adapter

Database handle for saving changes.

Type

\Horde_Db_Adapter

Methods

__construct()

__construct(string  $name, integer  $cacheVersion = null, string  $type = 'matrix', array  $params = null) 

Constructor.

Parameters

string $name

The name of the perm.

integer $cacheVersion

The revision number of the class.

string $type

The permission type.

array $params

A hash with any parameters that the permission type needs.

setCacheVersion()

setCacheVersion(integer  $cacheVersion) 

Sets the revision number of the class.

Parameters

integer $cacheVersion

The revision number of the class.

get()

get(string  $attribute) : mixed

Gets one of the attributes of the object, or null if it isn't defined.

Parameters

string $attribute

The attribute to get.

Returns

mixed —

The value of the attribute, or null.

getName()

getName() : string

Get permission name.

Returns

string —

Permission name.

setName()

setName(string  $name) 

Set permission name

Parameters

string $name

Permission name.

getData()

getData() : array

Get permission details.

Returns

array —

Permission details.

setData()

setData(string  $data) 

Set permission details.

Parameters

string $data

Permission details.

updatePermissions()

updatePermissions(array  $perms) 

Updates the permissions based on data passed in the array.

Parameters

array $perms

An array containing the permissions which are to be updated.

setPerm()

setPerm(  $permId,   $permission,   $update = true) 

TODO

Parameters

$permId
$permission
$update

unsetPerm()

unsetPerm(  $permId,   $permission,   $update = true) 

TODO

Parameters

$permId
$permission
$update

addUserPermission()

addUserPermission(  $user, integer  $permission, boolean  $update = true) 

Grants a user additional permissions to this object.

Parameters

$user
integer $permission

The permission (DELETE, etc.) to add.

boolean $update

Whether to automatically update the backend.

addGuestPermission()

addGuestPermission(integer  $permission, boolean  $update = true) 

Grants guests additional permissions to this object.

Parameters

integer $permission

The permission (DELETE, etc.) to add.

boolean $update

Whether to automatically update the backend.

addCreatorPermission()

addCreatorPermission(integer  $permission, boolean  $update = true) 

Grants creators additional permissions to this object.

Parameters

integer $permission

The permission (DELETE, etc.) to add.

boolean $update

Whether to automatically update the backend.

addDefaultPermission()

addDefaultPermission(integer  $permission, boolean  $update = true) 

Grants additional default permissions to this object.

Parameters

integer $permission

The permission (DELETE, etc.) to add.

boolean $update

Whether to automatically update the backend.

addGroupPermission()

addGroupPermission(integer  $groupId, integer  $permission, boolean  $update = true) 

Grants a group additional permissions to this object.

Parameters

integer $groupId

The id of the group to grant additional permissions to.

integer $permission

The permission (DELETE, etc.) to add.

boolean $update

Whether to automatically update the backend.

removeUserPermission()

removeUserPermission(string  $user = null, integer  $permission = null, boolean  $update = true) 

Removes a permission that a user currently has on this object.

Parameters

string $user

The user to remove the permission from. Defaults to all users.

integer $permission

The permission (DELETE, etc.) to remove. Defaults to all permissions.

boolean $update

Whether to automatically update the backend.

removeGuestPermission()

removeGuestPermission(integer  $permission = null, boolean  $update = true) 

Removes a permission that guests currently have on this object.

Parameters

integer $permission

The permission (DELETE, etc.) to remove. Defaults to all permissions.

boolean $update

Whether to automatically update the backend.

removeCreatorPermission()

removeCreatorPermission(integer  $permission = null, boolean  $update = true) 

Removes a permission that creators currently have on this object.

Parameters

integer $permission

The permission (DELETE, etc.) to remove. Defaults to all permissions.

boolean $update

Whether to automatically update the backend.

removeDefaultPermission()

removeDefaultPermission(integer  $permission = null, boolean  $update = true) 

Removes a default permission on this object.

Parameters

integer $permission

The permission (DELETE, etc.) to remove. Defaults to all permissions.

boolean $update

Whether to automatically update the backend.

removeGroupPermission()

removeGroupPermission(integer  $groupId = null, integer  $permission = null, boolean  $update = true) 

Removes a permission that a group currently has on this object.

Parameters

integer $groupId

The id of the group to remove the permission from. Defaults to all groups.

integer $permission

The permission (DELETE, etc.) to remove. Defaults to all permissions.

boolean $update

Whether to automatically update the backend.

getUserPermissions()

getUserPermissions(integer  $perm = null) : array

Returns an array of all user permissions on this object.

Parameters

integer $perm

List only users with this permission level. Defaults to all users.

Returns

array —

All user permissions for this object, indexed by user.

getGuestPermissions()

getGuestPermissions() : integer

Returns the guest permissions on this object.

Returns

integer —

The guest permissions on this object.

getCreatorPermissions()

getCreatorPermissions() : integer

Returns the creator permissions on this object.

Returns

integer —

The creator permissions on this object.

getDefaultPermissions()

getDefaultPermissions() : integer

Returns the default permissions on this object.

Returns

integer —

The default permissions on this object.

getGroupPermissions()

getGroupPermissions(integer  $perm = null) : array

Returns an array of all group permissions on this object.

Parameters

integer $perm

List only users with this permission level. Defaults to all users.

Returns

array —

All group permissions for this object, indexed by group.

save()

save() 

Saves any changes to this object to the backend permanently. New objects are added instead.

Throws

\Horde_Perms_Exception

__sleep()

__sleep() : array

Tasks to run on serialize().

Returns

array —

Parameters that are stored.

setObs()

setObs(\Horde_Cache  $cache, \Horde_Db_Adapter  $db) 

Sets the helper functions within the object.

Parameters

\Horde_Cache $cache

The cache object.

\Horde_Db_Adapter $db

The database object.

getId()

getId() : \TODO

Get permission ID.

Returns

\TODO

setId()

setId(string  $id) 

Set permission id.

Parameters

string $id

Permission ID.