Horde_Perms_Permission_Sql
extends Horde_Perms_Permission
in package
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.
Tags
Table of Contents
- $data : mixed
- TODO
- $name : mixed
- TODO
- $_cache : Horde_Cache
- Cache object.
- $_cacheVersion : int
- Incrementing version number if cached classes change.
- $_db : Horde_Db_Adapter
- Database handle for saving changes.
- $_id : string
- The string permission id.
- __construct() : mixed
- Constructor.
- __sleep() : array<string|int, mixed>
- Tasks to run on serialize().
- addCreatorPermission() : mixed
- Grants creators additional permissions to this object.
- addDefaultPermission() : mixed
- Grants additional default permissions to this object.
- addGroupPermission() : mixed
- Grants a group additional permissions to this object.
- addGuestPermission() : mixed
- Grants guests additional permissions to this object.
- addUserPermission() : mixed
- Grants a user additional permissions to this object.
- get() : mixed
- Gets one of the attributes of the object, or null if it isn't defined.
- getCreatorPermissions() : int
- Returns the creator permissions on this object.
- getData() : array<string|int, mixed>
- Get permission details.
- getDefaultPermissions() : int
- Returns the default permissions on this object.
- getGroupPermissions() : array<string|int, mixed>
- Returns an array of all group permissions on this object.
- getGuestPermissions() : int
- Returns the guest permissions on this object.
- getId() : TODO
- Get permission ID.
- getName() : string
- Get permission name.
- getUserPermissions() : array<string|int, mixed>
- Returns an array of all user permissions on this object.
- removeCreatorPermission() : mixed
- Removes a permission that creators currently have on this object.
- removeDefaultPermission() : mixed
- Removes a default permission on this object.
- removeGroupPermission() : mixed
- Removes a permission that a group currently has on this object.
- removeGuestPermission() : mixed
- Removes a permission that guests currently have on this object.
- removeUserPermission() : mixed
- Removes a permission that a user currently has on this object.
- save() : mixed
- Saves any changes to this object to the backend permanently. New objects are added instead.
- setCacheVersion() : mixed
- Sets the revision number of the class.
- setData() : mixed
- Set permission details.
- setId() : mixed
- Set permission id.
- setName() : mixed
- Set permission name
- setObs() : mixed
- Sets the helper functions within the object.
- setPerm() : mixed
- TODO
- unsetPerm() : mixed
- TODO
- updatePermissions() : mixed
- Updates the permissions based on data passed in the array.
Properties
$data
TODO
public
mixed
$data
$name
TODO
public
mixed
$name
$_cache
Cache object.
protected
Horde_Cache
$_cache
$_cacheVersion
Incrementing version number if cached classes change.
protected
int
$_cacheVersion
$_db
Database handle for saving changes.
protected
Horde_Db_Adapter
$_db
$_id
The string permission id.
protected
string
$_id
Methods
__construct()
Constructor.
public
__construct(string $name[, int $cacheVersion = null ][, string $type = 'matrix' ][, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
-
The name of the perm.
- $cacheVersion : int = null
-
The revision number of the class.
- $type : string = 'matrix'
-
The permission type.
- $params : array<string|int, mixed> = null
-
A hash with any parameters that the permission type needs.
Return values
mixed —__sleep()
Tasks to run on serialize().
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed> —Parameters that are stored.
addCreatorPermission()
Grants creators additional permissions to this object.
public
addCreatorPermission(int $permission[, bool $update = true ]) : mixed
Parameters
- $permission : int
-
The permission (DELETE, etc.) to add.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —addDefaultPermission()
Grants additional default permissions to this object.
public
addDefaultPermission(int $permission[, bool $update = true ]) : mixed
Parameters
- $permission : int
-
The permission (DELETE, etc.) to add.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —addGroupPermission()
Grants a group additional permissions to this object.
public
addGroupPermission(int $groupId, int $permission[, bool $update = true ]) : mixed
Parameters
- $groupId : int
-
The id of the group to grant additional permissions to.
- $permission : int
-
The permission (DELETE, etc.) to add.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —addGuestPermission()
Grants guests additional permissions to this object.
public
addGuestPermission(int $permission[, bool $update = true ]) : mixed
Parameters
- $permission : int
-
The permission (DELETE, etc.) to add.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —addUserPermission()
Grants a user additional permissions to this object.
public
addUserPermission(mixed $user, int $permission[, bool $update = true ]) : mixed
Parameters
- $user : mixed
- $permission : int
-
The permission (DELETE, etc.) to add.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —get()
Gets one of the attributes of the object, or null if it isn't defined.
public
get(string $attribute) : mixed
Parameters
- $attribute : string
-
The attribute to get.
Return values
mixed —The value of the attribute, or null.
getCreatorPermissions()
Returns the creator permissions on this object.
public
getCreatorPermissions() : int
Return values
int —The creator permissions on this object.
getData()
Get permission details.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —Permission details.
getDefaultPermissions()
Returns the default permissions on this object.
public
getDefaultPermissions() : int
Return values
int —The default permissions on this object.
getGroupPermissions()
Returns an array of all group permissions on this object.
public
getGroupPermissions([int $perm = null ]) : array<string|int, mixed>
Parameters
- $perm : int = null
-
List only users with this permission level. Defaults to all users.
Return values
array<string|int, mixed> —All group permissions for this object, indexed by group.
getGuestPermissions()
Returns the guest permissions on this object.
public
getGuestPermissions() : int
Return values
int —The guest permissions on this object.
getId()
Get permission ID.
public
getId() : TODO
Return values
TODO —getName()
Get permission name.
public
getName() : string
Return values
string —Permission name.
getUserPermissions()
Returns an array of all user permissions on this object.
public
getUserPermissions([int $perm = null ]) : array<string|int, mixed>
Parameters
- $perm : int = null
-
List only users with this permission level. Defaults to all users.
Return values
array<string|int, mixed> —All user permissions for this object, indexed by user.
removeCreatorPermission()
Removes a permission that creators currently have on this object.
public
removeCreatorPermission([int $permission = null ][, bool $update = true ]) : mixed
Parameters
- $permission : int = null
-
The permission (DELETE, etc.) to remove. Defaults to all permissions.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —removeDefaultPermission()
Removes a default permission on this object.
public
removeDefaultPermission([int $permission = null ][, bool $update = true ]) : mixed
Parameters
- $permission : int = null
-
The permission (DELETE, etc.) to remove. Defaults to all permissions.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —removeGroupPermission()
Removes a permission that a group currently has on this object.
public
removeGroupPermission([int $groupId = null ][, int $permission = null ][, bool $update = true ]) : mixed
Parameters
- $groupId : int = null
-
The id of the group to remove the permission from. Defaults to all groups.
- $permission : int = null
-
The permission (DELETE, etc.) to remove. Defaults to all permissions.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —removeGuestPermission()
Removes a permission that guests currently have on this object.
public
removeGuestPermission([int $permission = null ][, bool $update = true ]) : mixed
Parameters
- $permission : int = null
-
The permission (DELETE, etc.) to remove. Defaults to all permissions.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —removeUserPermission()
Removes a permission that a user currently has on this object.
public
removeUserPermission([string $user = null ][, int $permission = null ][, bool $update = true ]) : mixed
Parameters
- $user : string = null
-
The user to remove the permission from. Defaults to all users.
- $permission : int = null
-
The permission (DELETE, etc.) to remove. Defaults to all permissions.
- $update : bool = true
-
Whether to automatically update the backend.
Return values
mixed —save()
Saves any changes to this object to the backend permanently. New objects are added instead.
public
save() : mixed
Tags
Return values
mixed —setCacheVersion()
Sets the revision number of the class.
public
setCacheVersion(int $cacheVersion) : mixed
Parameters
- $cacheVersion : int
-
The revision number of the class.
Return values
mixed —setData()
Set permission details.
public
setData(string $data) : mixed
Parameters
- $data : string
-
Permission details.
Return values
mixed —setId()
Set permission id.
public
setId(string $id) : mixed
Parameters
- $id : string
-
Permission ID.
Return values
mixed —setName()
Set permission name
public
setName(string $name) : mixed
Parameters
- $name : string
-
Permission name.
Return values
mixed —setObs()
Sets the helper functions within the object.
public
setObs(Horde_Cache $cache, Horde_Db_Adapter $db) : mixed
Parameters
- $cache : Horde_Cache
-
The cache object.
- $db : Horde_Db_Adapter
-
The database object.
Return values
mixed —setPerm()
TODO
public
setPerm(mixed $permId, mixed $permission[, mixed $update = true ]) : mixed
Parameters
- $permId : mixed
- $permission : mixed
- $update : mixed = true
Return values
mixed —unsetPerm()
TODO
public
unsetPerm(mixed $permId, mixed $permission[, mixed $update = true ]) : mixed
Parameters
- $permId : mixed
- $permission : mixed
- $update : mixed = true
Return values
mixed —updatePermissions()
Updates the permissions based on data passed in the array.
public
updatePermissions(array<string|int, mixed> $perms) : mixed
Parameters
- $perms : array<string|int, mixed>
-
An array containing the permissions which are to be updated.