PHP Class Airship\Cabin\Bridge\Blueprint\Permissions

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

Public Methods

Method 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.

Protected Methods

Method 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 method

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
return array

buildMultiContextGroupTree() public method

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
return array

buildMultiContextUserList() public method

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
return array

buildUserList() public method

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]]
return array

createAction() public method

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

createContext() public method

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

flattenContextList() protected method

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

flattenContextTree() protected method

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

flattenMultiContextList() protected method

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

flattenMultiContextTree() protected method

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

getAction() public method

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

getActionNames() public method

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

getActions() public method

List all actions for a cabin.
public getActions ( string $cabin ) : array
$cabin string
return array

getContext() public method

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

getContextIds() public method

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
return array

getContexts() public method

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

getContextsForURI() public method

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
return array

getGroupPerms() public method

public getGroupPerms ( integer $groupId, integer $contextId ) : array
$groupId integer
$contextId integer
return array

getGroupRulesForContextSave() protected method

protected getGroupRulesForContextSave ( array $actions, integer $contextId ) : array
$actions array
$contextId integer
return array

getUserPerms() public method

public getUserPerms ( integer $userId, integer $contextId ) : array
$userId integer
$contextId integer
return array

getUserRulesForContextSave() protected method

protected getUserRulesForContextSave ( array $actions, integer $contextId ) : array
$actions array
$contextId integer
return array

permBoolean() protected method

protected permBoolean ( array $postValue = [], array $keys = [] ) : array
$postValue array
$keys array
return array

saveAction() public method

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

saveContext() public method

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
return boolean