PHP Class li3_access\security\Access

Inheritance: extends lithium\core\Adaptable
Show file Open project: tmaiaroto/li3_access Class Usage Examples

Protected Properties

Property Type Description
$_adapters Libraries::locate() compatible path to adapters for this class.
$_classes Dynamic class dependencies.
$_configurations Stores configurations for various authentication adapters.

Public Methods

Method Description
check ( string $name, mixed $user, mixed $params, array $options = [] ) : Array Performs an access check against the specified configuration, and returns true if access is permitted and an array with additional details if access is denied.

Protected Methods

Method Description
_initConfig ( string $name, array $config ) : array Called when an adapter configuration is first accessed, this method sets the default configuration for session handling. While each configuration can use its own session class and options, this method initializes them to the default dependencies written into the class.

Method Details

_initConfig() protected static method

For the session key name, the default value is set to the name of the configuration.
protected static _initConfig ( string $name, array $config ) : array
$name string The name of the adapter configuration being accessed.
$config array The user-specified configuration.
return array Returns an array that merges the user-specified configuration with the generated default values.

check() public static method

The data return when access is not permitted will vary by adapter, but it is ideal to have a "message" and a "redirect" so that a user can be notified about why they were denied access and so they can be redirected somewhere to, perhaps, login.
public static check ( string $name, mixed $user, mixed $params, array $options = [] ) : Array
$name string The name of the `Access` configuration/adapter to check against.
$user mixed The user data array that holds all necessary information about the user requesting access. Or `false` (because `Auth::check()` can return `false`).
$params mixed The Lithium `Request` object, or an array with at least 'request', and 'params'
$options array An array of additional options.
return Array An empty array if access is allowed and an array with reasons for denial if denied.

Property Details

$_adapters protected static property

Libraries::locate() compatible path to adapters for this class.
See also: lithium\core\Libraries::locate()
protected static $_adapters

$_classes protected static property

Dynamic class dependencies.
protected static $_classes

$_configurations protected static property

Stores configurations for various authentication adapters.
protected static $_configurations