Method | Description | |
---|---|---|
__static ( ) | Register plugin hooks | |
_filter_permission_display ( $permission ) : string | function _filter_permission_display Filter to localize permission names | |
_filter_token_description_display ( $token ) : string | function _filter_token_description_display Filter to localize token descriptions | |
_filter_token_group_display ( $group ) : string | function _filter_token_group_display Filter to localize token group name | |
access_check ( |
Check a permission bitmask for a particular access type. | |
access_names ( ) : array | Obtain the list of access names (CRUD) to use for permissions. | |
all_tokens ( string $order = 'id' ) : array | Get an array of QueryRecord objects containing all permission tokens | |
clear_caches ( ) | Clears all caches used to hold permissions | |
create_default_tokens ( ) | Creates the default set of permissions. | |
create_token ( string $name, string $description, string $group, boolean $crud = false ) : mixed | Create a new permission token, and save it to the permission tokens table | |
deny_group ( integer $group_id, mixed $token_id ) : Result | Deny permission to a group | |
deny_user ( integer $user_id, mixed $token_id ) : Result | Deny permission to a user | |
destroy_token ( $token ) : boolean | Remove a permission token, and any assignments of it | |
get_bitmask ( integer $mask ) : |
Get a Bitmask object representing the supplied access integer | |
get_group_token_access ( integer $group, mixed $token_id ) : an | Get the access bitmask of a group for a specific permission token | |
get_user_token_access ( |
Return the access bitmask to a specific token for a specific user | |
grant_group ( integer $group_id, mixed $token_id, string $access = 'full' ) : Result | Grant a permission to a group | |
grant_user ( integer $user_id, integer $token_id, string $access = 'full' ) : Result | Grant a permission to a user | |
group_can ( mixed $group, mixed $token_id, string $access = 'full' ) : boolean | Determine whether a group can perform a specific action | |
group_cannot ( $group, mixed $token_id ) : boolean | Determine whether a group is explicitly denied permission to perform a specific action This function does not return true if the group is merely not granted a permission | |
normalize_token ( string $name ) : string | Convert a token name into a valid format | |
rebuild_permissions ( $user = null ) | Reset premissions to their default state | |
revoke_group_token ( integer $group_id, mixed $token_id ) : the | Remove a permission token from the group permissions table | |
revoke_user_token ( integer $user_id, mixed $token_id ) : the | Remove a permission token from the user permissions table | |
token_description ( mixed $permission ) : string | Fetch a permission token's description from the DB | |
token_exists ( mixed $permission ) : boolean | Determine whether a permission token exists | |
token_id ( string $name ) : integer | Get a permission token's ID by its name | |
token_name ( integer $id ) : string | Get a permission token's name by its ID | |
user_can ( mixed $user, mixed $token_id, string $access = 'full' ) : boolean | Determine whether a user can perform a specific action | |
user_cannot ( mixed $user, mixed $token_id ) : boolean | Determine whether a user is explicitly denied permission to perform a specific action This function does not return true if the user is merely not granted a permission | |
user_tokens ( mixed $user, string $access = 'full', $posts_only = false ) : array | Get all the tokens for a given user with a particular kind of access |
Method | Description | |
---|---|---|
cache_tokens ( ) : array | Get an associative array of token ids and their name. |
public static _filter_permission_display ( $permission ) : string | ||
return | string | The localized permission name |
public static _filter_token_description_display ( $token ) : string | ||
return | string | The localized token description |
public static _filter_token_group_display ( $group ) : string | ||
return | string | The localized token group name |
public static access_check ( |
||
$bitmask | The permission bitmask | |
$access | mixed | The name of the access to check against (read, write, full) |
return | boolean | Returns true if the given access meets exceeds the access to check against |
public static access_names ( ) : array | ||
return | array | the list of access names available to ACL |
public static all_tokens ( string $order = 'id' ) : array | ||
$order | string | the order in which to sort the returning array |
return | array | an array of QueryRecord objects containing all tokens |
public static clear_caches ( ) |
public static create_default_tokens ( ) |
public static create_token ( string $name, string $description, string $group, boolean $crud = false ) : mixed | ||
$name | string | The name of the permission |
$description | string | The description of the permission |
$group | string | The token group for organizational purposes |
$crud | boolean | Indicates if the token is a CRUD or boolean type token (default is boolean) |
return | mixed | the ID of the newly created permission, or boolean false |
public static deny_group ( integer $group_id, mixed $token_id ) : Result | ||
$group_id | integer | The group ID |
$token_id | mixed | The name or ID of the permission token |
return | Result | of the DB query |
public static destroy_token ( $token ) : boolean | ||
return | boolean | whether the permission was deleted or not |
public static get_bitmask ( integer $mask ) : |
||
$mask | integer | The access mask, usually stored in the database |
return | An object representing the access value |
public static get_group_token_access ( integer $group, mixed $token_id ) : an | ||
$group | integer | The group ID |
$token_id | mixed | A permission name or ID |
return | an | access bitmask |
public static group_can ( mixed $group, mixed $token_id, string $access = 'full' ) : boolean | ||
$group | mixed | A group ID or name |
$token_id | mixed | A permission token ID or name |
$access | string | Check for 'create', 'read', 'update', 'delete', or 'full' access |
return | boolean | Whether the group can perform the action |
public static group_cannot ( $group, mixed $token_id ) : boolean | ||
$token_id | mixed | A permission ID or name |
return | boolean | True if access to the token is denied to the group |
public static normalize_token ( string $name ) : string | ||
$name | string | The name of a permission |
return | string | The permission with spaces converted to underscores and all lowercase |
public static rebuild_permissions ( $user = null ) |
public static revoke_group_token ( integer $group_id, mixed $token_id ) : the | ||
$group_id | integer | The group ID |
$token_id | mixed | The name or ID of the permission token |
return | the | result of the DB query |
public static revoke_user_token ( integer $user_id, mixed $token_id ) : the | ||
$user_id | integer | The user ID |
$token_id | mixed | The name or ID of the permission token |
return | the | result of the DB query |
public static token_description ( mixed $permission ) : string | ||
$permission | mixed | a permission name or ID |
return | string | the description of the permission |
public static token_exists ( mixed $permission ) : boolean | ||
$permission | mixed | a permission name or ID |
return | boolean | whether the permission exists or not |
public static token_name ( integer $id ) : string | ||
$id | integer | a token ID |
return | string | the name of the permission, or boolean false |
public static user_can ( mixed $user, mixed $token_id, string $access = 'full' ) : boolean | ||
$user | mixed | A user object, user ID or a username |
$token_id | mixed | A permission ID or name |
$access | string | Check for 'create', 'read', 'update', 'delete', or 'full' access |
return | boolean | Whether the user can perform the action |