PHP Class Airship\Cabin\Bridge\Blueprint\Permissions

This is used by administrative users to manage access controls throughout various cabins.
Inheritance: extends BlueprintGear
Afficher le fichier Open project: paragonie/airship Class Usage Examples

Méthodes publiques

Méthode Description
buildGroupTree ( string $cabin, integer $contextId, array $actions = [], integer $parentId, array $inherited = [], integer $depth ) : array Build a hierarchical tree containing all of the groups' permissions
buildMultiContextGroupTree ( string $cabin, array $contexts = [], array $actions = [] ) : array Build a multi-context tree; make sure to && the permissions together
buildMultiContextUserList ( string $cabin, array $contexts = [], array $actions = [] ) : array Build a multi-context tree; make sure to && the permissions together
buildUserList ( string $cabin, integer $contextId, array $actions = [] ) : array Build a heirarchal tree containing all of the groups' permissions
createAction ( string $cabin, string $label ) : boolean Create a new database action for a specific Cabin.
createContext ( string $cabin, string $locator ) : boolean Create a new context for a specific cabin.
getAction ( string $cabin, integer $actionId ) : array Get information about an action.
getActionNames ( string $cabin ) : array Get all action labels for a particular cabin.
getActions ( string $cabin ) : array List all actions for a cabin.
getContext ( integer $contextId, string $cabin = CABIN_NAME ) : array Get all contexts for a cabin
getContextIds ( string $uri = '', string $cabin = CABIN_NAME ) : array Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
getContexts ( string $cabin = CABIN_NAME ) : array Get all contexts for a cabin
getContextsForURI ( string $uri = '', string $cabin = CABIN_NAME ) : array Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
getGroupPerms ( integer $groupId, integer $contextId ) : array
getUserPerms ( integer $userId, integer $contextId ) : array
saveAction ( string $cabin, integer $actionId, array $post = [] ) : boolean Update the label for a given action.
saveContext ( string $cabin, integer $contextId, array $post ) : boolean Saves a permission context. This affects the context itself as well as the whitelist.

Méthodes protégées

Méthode Description
flattenContextList ( array $return, array $perms, array $actions = [] ) : array
flattenContextTree ( array $return, array $perms, array $actions = [] ) : array
flattenMultiContextList ( array $return, array $contexts, array $actions = [] ) : array Flatten multiple context lists.
flattenMultiContextTree ( array $return, array $contexts, array $actions = [] ) : array
getGroupRulesForContextSave ( array $actions, integer $contextId ) : array
getUserRulesForContextSave ( array $actions, integer $contextId ) : array
permBoolean ( array $postValue = [], array $keys = [] ) : array

Method Details

buildGroupTree() public méthode

Build a hierarchical tree containing all of the groups' permissions
public buildGroupTree ( string $cabin, integer $contextId, array $actions = [], integer $parentId, array $inherited = [], integer $depth ) : array
$cabin string Which cabin does this apply to?
$contextId integer Context IDs (see permissions sql)
$actions array Actions in Scope [ [id => label], [id2 => label2] ]
$parentId integer The group whose children we are evaluating
$inherited array
$depth integer the depth of our recursive search
Résultat array

buildMultiContextGroupTree() public méthode

Build a multi-context tree; make sure to && the permissions together
public buildMultiContextGroupTree ( string $cabin, array $contexts = [], array $actions = [] ) : array
$cabin string
$contexts array
$actions array
Résultat array

buildMultiContextUserList() public méthode

Build a multi-context tree; make sure to && the permissions together
public buildMultiContextUserList ( string $cabin, array $contexts = [], array $actions = [] ) : array
$cabin string
$contexts array
$actions array
Résultat array

buildUserList() public méthode

Build a heirarchal tree containing all of the groups' permissions
public buildUserList ( string $cabin, integer $contextId, array $actions = [] ) : array
$cabin string Which cabin does this apply to?
$contextId integer Context IDs (see permissions sql)
$actions array Actions in Scope [[id => label], [id2 => label2]]
Résultat array

createAction() public méthode

Create a new database action for a specific Cabin.
public createAction ( string $cabin, string $label ) : boolean
$cabin string
$label string
Résultat boolean

createContext() public méthode

Create a new context for a specific cabin.
public createContext ( string $cabin, string $locator ) : boolean
$cabin string
$locator string
Résultat boolean

flattenContextList() protected méthode

protected flattenContextList ( array $return, array $perms, array $actions = [] ) : array
$return array
$perms array
$actions array
Résultat array

flattenContextTree() protected méthode

protected flattenContextTree ( array $return, array $perms, array $actions = [] ) : array
$return array
$perms array
$actions array
Résultat array

flattenMultiContextList() protected méthode

Flatten multiple context lists.
protected flattenMultiContextList ( array $return, array $contexts, array $actions = [] ) : array
$return array
$contexts array
$actions array
Résultat array

flattenMultiContextTree() protected méthode

protected flattenMultiContextTree ( array $return, array $contexts, array $actions = [] ) : array
$return array
$contexts array
$actions array
Résultat array

getAction() public méthode

Get information about an action.
public getAction ( string $cabin, integer $actionId ) : array
$cabin string
$actionId integer
Résultat array

getActionNames() public méthode

Get all action labels for a particular cabin.
public getActionNames ( string $cabin ) : array
$cabin string
Résultat array

getActions() public méthode

List all actions for a cabin.
public getActions ( string $cabin ) : array
$cabin string
Résultat array

getContext() public méthode

Get all contexts for a cabin
public getContext ( integer $contextId, string $cabin = CABIN_NAME ) : array
$contextId integer
$cabin string Cabin
Résultat array

getContextIds() public méthode

Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
public getContextIds ( string $uri = '', string $cabin = CABIN_NAME ) : array
$uri string Context
$cabin string Cabin
Résultat array

getContexts() public méthode

Get all contexts for a cabin
public getContexts ( string $cabin = CABIN_NAME ) : array
$cabin string Cabin
Résultat array

getContextsForURI() public méthode

Returns an array with overlapping context IDs -- useful for when contexts are used with regular expressions
public getContextsForURI ( string $uri = '', string $cabin = CABIN_NAME ) : array
$uri string Context
$cabin string Cabin
Résultat array

getGroupPerms() public méthode

public getGroupPerms ( integer $groupId, integer $contextId ) : array
$groupId integer
$contextId integer
Résultat array

getGroupRulesForContextSave() protected méthode

protected getGroupRulesForContextSave ( array $actions, integer $contextId ) : array
$actions array
$contextId integer
Résultat array

getUserPerms() public méthode

public getUserPerms ( integer $userId, integer $contextId ) : array
$userId integer
$contextId integer
Résultat array

getUserRulesForContextSave() protected méthode

protected getUserRulesForContextSave ( array $actions, integer $contextId ) : array
$actions array
$contextId integer
Résultat array

permBoolean() protected méthode

protected permBoolean ( array $postValue = [], array $keys = [] ) : array
$postValue array
$keys array
Résultat array

saveAction() public méthode

Update the label for a given action.
public saveAction ( string $cabin, integer $actionId, array $post = [] ) : boolean
$cabin string
$actionId integer
$post array
Résultat boolean

saveContext() public méthode

Saves a permission context. This affects the context itself as well as the whitelist.
public saveContext ( string $cabin, integer $contextId, array $post ) : boolean
$cabin string Which Cabin?
$contextId integer Which context?
$post array POST data
Résultat boolean