PHP Class Horde_Perms_Permission, horde

Copyright 2009-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: Chuck Hagenbuch ([email protected])
Author: Jan Schneider ([email protected])
Show file Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$data TODO
$name TODO

Protected Properties

Property Type Description
$_cacheVersion integer Incrementing version number if cached classes change.

Public Methods

Method Description
__construct ( string $name, integer $cacheVersion = null, string $type = 'matrix', array $params = null ) Constructor.
addCreatorPermission ( integer $permission, boolean $update = true ) Grants creators additional permissions to this object.
addDefaultPermission ( integer $permission, boolean $update = true ) Grants additional default permissions to this object.
addGroupPermission ( integer $groupId, integer $permission, boolean $update = true ) Grants a group additional permissions to this object.
addGuestPermission ( integer $permission, boolean $update = true ) Grants guests additional permissions to this object.
addUserPermission ( $user, integer $permission, boolean $update = true ) Grants a user additional permissions to this object.
get ( string $attribute ) : mixed Gets one of the attributes of the object, or null if it isn't defined.
getCreatorPermissions ( ) : integer Returns the creator permissions on this object.
getData ( ) : array Get permission details.
getDefaultPermissions ( ) : integer Returns the default permissions on this object.
getGroupPermissions ( integer $perm = null ) : array Returns an array of all group permissions on this object.
getGuestPermissions ( ) : integer Returns the guest permissions on this object.
getName ( ) : string Get permission name.
getUserPermissions ( integer $perm = null ) : array Returns an array of all user permissions on this object.
removeCreatorPermission ( integer $permission = null, boolean $update = true ) Removes a permission that creators currently have on this object.
removeDefaultPermission ( integer $permission = null, boolean $update = true ) Removes a default permission on this object.
removeGroupPermission ( integer $groupId = null, integer $permission = null, boolean $update = true ) Removes a permission that a group currently has on this object.
removeGuestPermission ( integer $permission = null, boolean $update = true ) Removes a permission that guests currently have on this object.
removeUserPermission ( string $user = null, integer $permission = null, boolean $update = true ) Removes a permission that a user currently has on this object.
save ( ) TODO
setCacheVersion ( integer $cacheVersion ) Sets the revision number of the class.
setData ( string $data ) Set permission details.
setName ( string $name ) Set permission name
setPerm ( $permId, $permission, $update = true ) TODO
unsetPerm ( $permId, $permission, $update = true ) TODO
updatePermissions ( array $perms ) Updates the permissions based on data passed in the array.

Method Details

__construct() public method

Constructor.
public __construct ( string $name, integer $cacheVersion = null, string $type = 'matrix', array $params = null )
$name string The name of the perm.
$cacheVersion integer The revision number of the class.
$type string The permission type.
$params array A hash with any parameters that the permission type needs.

addCreatorPermission() public method

Grants creators additional permissions to this object.
public addCreatorPermission ( integer $permission, boolean $update = true )
$permission integer The permission (DELETE, etc.) to add.
$update boolean Whether to automatically update the backend.

addDefaultPermission() public method

Grants additional default permissions to this object.
public addDefaultPermission ( integer $permission, boolean $update = true )
$permission integer The permission (DELETE, etc.) to add.
$update boolean Whether to automatically update the backend.

addGroupPermission() public method

Grants a group additional permissions to this object.
public addGroupPermission ( integer $groupId, integer $permission, boolean $update = true )
$groupId integer The id of the group to grant additional permissions to.
$permission integer The permission (DELETE, etc.) to add.
$update boolean Whether to automatically update the backend.

addGuestPermission() public method

Grants guests additional permissions to this object.
public addGuestPermission ( integer $permission, boolean $update = true )
$permission integer The permission (DELETE, etc.) to add.
$update boolean Whether to automatically update the backend.

addUserPermission() public method

Grants a user additional permissions to this object.
public addUserPermission ( $user, integer $permission, boolean $update = true )
$permission integer The permission (DELETE, etc.) to add.
$update boolean Whether to automatically update the backend.

get() public method

Gets one of the attributes of the object, or null if it isn't defined.
public get ( string $attribute ) : mixed
$attribute string The attribute to get.
return mixed The value of the attribute, or null.

getCreatorPermissions() public method

Returns the creator permissions on this object.
public getCreatorPermissions ( ) : integer
return integer The creator permissions on this object.

getData() public method

Get permission details.
public getData ( ) : array
return array Permission details.

getDefaultPermissions() public method

Returns the default permissions on this object.
public getDefaultPermissions ( ) : integer
return integer The default permissions on this object.

getGroupPermissions() public method

Returns an array of all group permissions on this object.
public getGroupPermissions ( integer $perm = null ) : array
$perm integer List only users with this permission level. Defaults to all users.
return array All group permissions for this object, indexed by group.

getGuestPermissions() public method

Returns the guest permissions on this object.
public getGuestPermissions ( ) : integer
return integer The guest permissions on this object.

getName() public method

Get permission name.
public getName ( ) : string
return string Permission name.

getUserPermissions() public method

Returns an array of all user permissions on this object.
public getUserPermissions ( integer $perm = null ) : array
$perm integer List only users with this permission level. Defaults to all users.
return array All user permissions for this object, indexed by user.

removeCreatorPermission() public method

Removes a permission that creators currently have on this object.
public removeCreatorPermission ( integer $permission = null, boolean $update = true )
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.

removeDefaultPermission() public method

Removes a default permission on this object.
public removeDefaultPermission ( integer $permission = null, boolean $update = true )
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.

removeGroupPermission() public method

Removes a permission that a group currently has on this object.
public removeGroupPermission ( integer $groupId = null, integer $permission = null, boolean $update = true )
$groupId integer The id of the group to remove the permission from. Defaults to all groups.
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.

removeGuestPermission() public method

Removes a permission that guests currently have on this object.
public removeGuestPermission ( integer $permission = null, boolean $update = true )
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.

removeUserPermission() public method

Removes a permission that a user currently has on this object.
public removeUserPermission ( string $user = null, integer $permission = null, boolean $update = true )
$user string The user to remove the permission from. Defaults to all users.
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.

save() public method

TODO
public save ( )

setCacheVersion() public method

Sets the revision number of the class.
public setCacheVersion ( integer $cacheVersion )
$cacheVersion integer The revision number of the class.

setData() public method

Set permission details.
public setData ( string $data )
$data string Permission details.

setName() public method

Set permission name
public setName ( string $name )
$name string Permission name.

setPerm() public method

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

unsetPerm() public method

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

updatePermissions() public method

Updates the permissions based on data passed in the array.
public updatePermissions ( array $perms )
$perms array An array containing the permissions which are to be updated.

Property Details

$_cacheVersion protected property

Incrementing version number if cached classes change.
protected int $_cacheVersion
return integer

$data public property

TODO
public $data

$name public property

TODO
public $name