PHP Trait TinyAuth\Auth\AclTrait

Mostra file Open project: dereuromark/cakephp-tinyauth

Protected Properties

Property Type Description
$_acl array | null
$_roles array | null

Protected Methods

Method Description
_check ( array $user, array $params ) : boolean Checks the URL to the role(s).
_constructIniKey ( array $params ) : string Constructs an ACL INI section key from a given Request.
_deconstructIniKey ( string $key ) : array Deconstructs an ACL INI section key into a named array with ACL parts.
_defaultConfig ( ) : array
_getAcl ( string | array | null $path = null ) : array Parses INI file and returns the allowed roles per action.
_getAvailableRoles ( ) : array Returns a list of all available roles.
_getUserRoles ( array $user ) : array Returns a list of all roles belonging to the authenticated user.
_mapped ( array $roles ) : array
_parseFiles ( array | string | null $paths, string $file ) : array Returns the acl.ini file(s) as an array.
_prepareConfig ( array $config ) : array

Method Details

_check() protected method

Allows single or multi role based authorization
protected _check ( array $user, array $params ) : boolean
$user array User data
$params array Request params
return boolean Success

_constructIniKey() protected method

Constructs an ACL INI section key from a given Request.
protected _constructIniKey ( array $params ) : string
$params array The request params
return string Hash with named keys for controller, plugin and prefix

_deconstructIniKey() protected method

Deconstructs an ACL INI section key into a named array with ACL parts.
protected _deconstructIniKey ( string $key ) : array
$key string INI section key as found in acl.ini
return array Array with named keys for controller, plugin and prefix

_defaultConfig() protected method

protected _defaultConfig ( ) : array
return array

_getAcl() protected method

Uses cache for maximum performance. Improved speed by several actions before caching: - Resolves role slugs to their primary key / identifier - Resolves wildcards to their verbose translation
protected _getAcl ( string | array | null $path = null ) : array
$path string | array | null
return array Roles

_getAvailableRoles() protected method

Will look for a roles array in Configure first, tries database roles table next.
protected _getAvailableRoles ( ) : array
return array List with all available roles

_getUserRoles() protected method

Lookup in the following order: - single role id using the roleColumn in single-role mode - direct lookup in the pivot table (to support both Configure and Model in multi-role mode)
protected _getUserRoles ( array $user ) : array
$user array The user to get the roles for
return array List with all role ids belonging to the user

_mapped() protected method

protected _mapped ( array $roles ) : array
$roles array
return array

_parseFiles() protected method

Returns the acl.ini file(s) as an array.
protected _parseFiles ( array | string | null $paths, string $file ) : array
$paths array | string | null Paths to look for INI file
$file string Full path to the INI file
return array List with all available roles

_prepareConfig() protected method

protected _prepareConfig ( array $config ) : array
$config array
return array

Property Details

$_acl protected_oe property

protected array|null $_acl
return array | null

$_roles protected_oe property

protected array|null $_roles
return array | null