PHP Trait Cartalyst\Sentinel\Permissions\PermissionsTrait

Show file Open project: cartalyst/sentinel

Protected Properties

Property Type Description
$permissions array The permissions.
$preparedPermissions array An array of cached, prepared permissions.
$secondaryPermissions array The secondary permissions.

Public Methods

Method Description
__construct ( array $permissions = null, array $secondaryPermissions = null ) : void Create a new permissions instance.
getSecondaryPermissions ( ) : array Returns the secondary permissions.
hasAccess ( $permissions ) {@inheritDoc}
hasAnyAccess ( $permissions ) {@inheritDoc}
setSecondaryPermissions ( array $secondaryPermissions ) : void Sets secondary permissions.

Protected Methods

Method Description
checkPermission ( array $prepared, string $permission ) : boolean Checks a permission in the prepared array, including wildcard checks and permissions.
createPreparedPermissions ( ) : void Returns the prepared permissions.
extractClassPermissions ( string $key ) : array Takes the given permission key and inspects it for a class & method. If it exists, methods may be comma-separated, e.g. Class@method1,method2.
getPreparedPermissions ( ) : array Lazily grab the prepared permissions.
preparePermissions ( array &$prepared, array $permissions ) : void Does the heavy lifting of preparing permissions.

Method Details

__construct() public method

Create a new permissions instance.
public __construct ( array $permissions = null, array $secondaryPermissions = null ) : void
$permissions array
$secondaryPermissions array
return void

checkPermission() protected method

Checks a permission in the prepared array, including wildcard checks and permissions.
protected checkPermission ( array $prepared, string $permission ) : boolean
$prepared array
$permission string
return boolean

createPreparedPermissions() abstract protected method

Returns the prepared permissions.
abstract protected createPreparedPermissions ( ) : void
return void

extractClassPermissions() protected method

Takes the given permission key and inspects it for a class & method. If it exists, methods may be comma-separated, e.g. Class@method1,method2.
protected extractClassPermissions ( string $key ) : array
$key string
return array

getPreparedPermissions() protected method

Lazily grab the prepared permissions.
protected getPreparedPermissions ( ) : array
return array

getSecondaryPermissions() public method

Returns the secondary permissions.
public getSecondaryPermissions ( ) : array
return array

hasAccess() public method

{@inheritDoc}
public hasAccess ( $permissions )

hasAnyAccess() public method

{@inheritDoc}
public hasAnyAccess ( $permissions )

preparePermissions() protected method

Does the heavy lifting of preparing permissions.
protected preparePermissions ( array &$prepared, array $permissions ) : void
$prepared array
$permissions array
return void

setSecondaryPermissions() public method

Sets secondary permissions.
public setSecondaryPermissions ( array $secondaryPermissions ) : void
$secondaryPermissions array
return void

Property Details

$permissions protected property

The permissions.
protected array $permissions
return array

$preparedPermissions protected property

An array of cached, prepared permissions.
protected array $preparedPermissions
return array

$secondaryPermissions protected property

The secondary permissions.
protected array $secondaryPermissions
return array