PHP Класс Airship\Engine\Security\Permissions

Manages user-based and role-based access controls with overlapping pattern-based contexts and a multi-site architecture, with a simple interface. i.e. $this->can('read') // bool(false)
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( DBInterface $db )
can ( string $action, string $context_path = '', string $cabin = CABIN_NAME, integer $user_id ) : boolean Perform a permissions check
checkGroup ( string $action, integer $context_id = null, integer $group_id = null, boolean $deep_search = true ) : boolean Do the members of this group have permission to do something?
checkUser ( string $action, integer $context_id = null, integer $user_id = null, boolean $ignore_superuser = false ) : boolean Check that the user, specifically, has permission to do something.
checkUsersGroups ( string $action = '', integer $context_id = null, integer $user_id = null, boolean $ignore_superuser = false ) : boolean Check that any of the users' groups has the permission bit
getOverlap ( string $context = '', string $cabin = CABIN_NAME ) : array Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
isSuperUser ( integer $user_id, boolean $ignore_groups = false ) : boolean Is this user a super user? Do they belong in a superuser group?

Описание методов

__construct() публичный Метод

public __construct ( DBInterface $db )
$db DBInterface

can() публичный Метод

Perform a permissions check
public can ( string $action, string $context_path = '', string $cabin = CABIN_NAME, integer $user_id ) : boolean
$action string action label (e.g. 'read')
$context_path string context regex (in perm_contexts)
$cabin string (defaults to current cabin)
$user_id integer (defaults to current user)
Результат boolean

checkGroup() публичный Метод

Do the members of this group have permission to do something?
public checkGroup ( string $action, integer $context_id = null, integer $group_id = null, boolean $deep_search = true ) : boolean
$action string - perm_actions.label
$context_id integer - perm_contexts.contextid
$group_id integer - groups.groupid
$deep_search boolean - Also search groups' inheritances
Результат boolean

checkUser() публичный Метод

Ignores group-based access controls.
public checkUser ( string $action, integer $context_id = null, integer $user_id = null, boolean $ignore_superuser = false ) : boolean
$action string
$context_id integer
$user_id integer
$ignore_superuser boolean
Результат boolean

checkUsersGroups() публичный Метод

Check that any of the users' groups has the permission bit
public checkUsersGroups ( string $action = '', integer $context_id = null, integer $user_id = null, boolean $ignore_superuser = false ) : boolean
$action string
$context_id integer
$user_id integer
$ignore_superuser boolean
Результат boolean

getOverlap() публичный Метод

Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
public getOverlap ( string $context = '', string $cabin = CABIN_NAME ) : array
$context string Context
$cabin string Cabin
Результат array

isSuperUser() публичный Метод

Is this user a super user? Do they belong in a superuser group?
public isSuperUser ( integer $user_id, boolean $ignore_groups = false ) : boolean
$user_id integer - User ID
$ignore_groups boolean - Don't look at their groups
Результат boolean