PHP Класс Phalcon\Acl\Adapter\Redis

Manages ACL lists in Redis Database
Наследование: extends Phalcon\Acl\Adapter
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$noArgumentsDefaultAction integer Default action for no arguments is allow
$redis Redis
$setNXAccess boolean

Открытые методы

Метод Описание
__construct ( $redis = null )
addInherit ( string $roleName, Phalcon\Acl\Role | string $roleToInherit )
addResource ( Phalcon\Acl\Resource | string $resource, array | string $accessList = null ) : boolean {@inheritdoc} Example: Add a resource to the the list allowing access to an action $acl->addResource(new Phalcon\Acl\Resource('customers'), 'search'); $acl->addResource('customers', 'search'); Add a resource with an access list $acl->addResource(new Phalcon\Acl\Resource('customers'), ['create', 'search']); $acl->addResource('customers', ['create', 'search']);
addResourceAccess ( string $resourceName, array | string $accessList ) : boolean
addRole ( Phalcon\Acl\Role | string $role, string $accessInherits = null ) : boolean
allow ( string $role, string $resource, array | string $access, mixed $func = null ) {@inheritdoc} You can use '*' as wildcard Example: Allow access to guests to search on customers $acl->allow('guests', 'customers', 'search'); Allow access to guests to search or create on customers $acl->allow('guests', 'customers', ['search', 'create']); Allow access to any role to browse on products $acl->allow('*', 'products', 'browse'); Allow access to any role to browse on any resource $acl->allow('*', '*', 'browse');
deny ( $role, $resource, array | string $access, mixed $func = null ) {@inheritdoc} You can use '*' as wildcard Example: Deny access to guests to search on customers $acl->deny('guests', 'customers', 'search'); Deny access to guests to search or create on customers $acl->deny('guests', 'customers', ['search', 'create']); Deny access to any role to browse on products $acl->deny('*', 'products', 'browse'); Deny access to any role to browse on any resource $acl->deny('*', '*', 'browse');
dropResourceAccess ( string $resource, array | string $accessList )
getNoArgumentsDefaultAction ( ) : integer Returns the default ACL access level for no arguments provided in isAllowed action if there exists func for accessKey
getRedis ( )
getResourceAccess ( $resource )
getResources ( ) : Phalcon\Acl\Resource[]
getRoleInherits ( $role ) : array
getRoles ( ) : Phalcon\Acl\RoleInterface[]
isAllowed ( string $role, string $resource, string $access, array $parameters = null ) : boolean {@inheritdoc} Example: Does Andres have access to the customers resource to create? $acl->isAllowed('Andres', 'Products', 'create'); Do guests have access to any resource to edit? $acl->isAllowed('guests', '*', 'edit');
isResource ( string $resourceName ) : boolean
isResourceAccess ( $resource, $access )
isRole ( string $roleName ) : boolean
setNoArgumentsDefaultAction ( integer $defaultAccess ) Sets the default access level for no arguments provided in isAllowed action if there exists func for accessKey
setRedis ( $redis, $chainRedis = false )

Защищенные методы

Метод Описание
allowOrDeny ( string $roleName, string $resourceName, array | string $access, integer $action ) Inserts/Updates a permission in the access list
resourcePermission ( $role, $access, $allowOrDeny )
rolePermission ( $resource, $access, $allowOrDeny )
setAccess ( $roleName, $resourceName, $accessName, $action ) : boolean

Описание методов

__construct() публичный Метод

public __construct ( $redis = null )

addInherit() публичный Метод

public addInherit ( string $roleName, Phalcon\Acl\Role | string $roleToInherit )
$roleName string
$roleToInherit Phalcon\Acl\Role | string

addResource() публичный Метод

{@inheritdoc} Example: Add a resource to the the list allowing access to an action $acl->addResource(new Phalcon\Acl\Resource('customers'), 'search'); $acl->addResource('customers', 'search'); Add a resource with an access list $acl->addResource(new Phalcon\Acl\Resource('customers'), ['create', 'search']); $acl->addResource('customers', ['create', 'search']);
public addResource ( Phalcon\Acl\Resource | string $resource, array | string $accessList = null ) : boolean
$resource Phalcon\Acl\Resource | string
$accessList array | string
Результат boolean

addResourceAccess() публичный Метод

public addResourceAccess ( string $resourceName, array | string $accessList ) : boolean
$resourceName string
$accessList array | string
Результат boolean

addRole() публичный Метод

Example: $acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultor'); $acl->addRole('administrator', 'consultor');
public addRole ( Phalcon\Acl\Role | string $role, string $accessInherits = null ) : boolean
$role Phalcon\Acl\Role | string
$accessInherits string
Результат boolean

allow() публичный Метод

{@inheritdoc} You can use '*' as wildcard Example: Allow access to guests to search on customers $acl->allow('guests', 'customers', 'search'); Allow access to guests to search or create on customers $acl->allow('guests', 'customers', ['search', 'create']); Allow access to any role to browse on products $acl->allow('*', 'products', 'browse'); Allow access to any role to browse on any resource $acl->allow('*', '*', 'browse');
public allow ( string $role, string $resource, array | string $access, mixed $func = null )
$role string
$resource string
$access array | string
$func mixed

allowOrDeny() защищенный Метод

Inserts/Updates a permission in the access list
protected allowOrDeny ( string $roleName, string $resourceName, array | string $access, integer $action )
$roleName string
$resourceName string
$access array | string
$action integer

deny() публичный Метод

{@inheritdoc} You can use '*' as wildcard Example: Deny access to guests to search on customers $acl->deny('guests', 'customers', 'search'); Deny access to guests to search or create on customers $acl->deny('guests', 'customers', ['search', 'create']); Deny access to any role to browse on products $acl->deny('*', 'products', 'browse'); Deny access to any role to browse on any resource $acl->deny('*', '*', 'browse');
public deny ( $role, $resource, array | string $access, mixed $func = null )
$access array | string
$func mixed

dropResourceAccess() публичный Метод

public dropResourceAccess ( string $resource, array | string $accessList )
$resource string
$accessList array | string

getNoArgumentsDefaultAction() публичный Метод

Returns the default ACL access level for no arguments provided in isAllowed action if there exists func for accessKey
public getNoArgumentsDefaultAction ( ) : integer
Результат integer

getRedis() публичный Метод

public getRedis ( )

getResourceAccess() публичный Метод

public getResourceAccess ( $resource )

getResources() публичный Метод

public getResources ( ) : Phalcon\Acl\Resource[]
Результат Phalcon\Acl\Resource[]

getRoleInherits() публичный Метод

public getRoleInherits ( $role ) : array
$role
Результат array

getRoles() публичный Метод

public getRoles ( ) : Phalcon\Acl\RoleInterface[]
Результат Phalcon\Acl\RoleInterface[]

isAllowed() публичный Метод

{@inheritdoc} Example: Does Andres have access to the customers resource to create? $acl->isAllowed('Andres', 'Products', 'create'); Do guests have access to any resource to edit? $acl->isAllowed('guests', '*', 'edit');
public isAllowed ( string $role, string $resource, string $access, array $parameters = null ) : boolean
$role string
$resource string
$access string
$parameters array
Результат boolean

isResource() публичный Метод

public isResource ( string $resourceName ) : boolean
$resourceName string
Результат boolean

isResourceAccess() публичный Метод

public isResourceAccess ( $resource, $access )

isRole() публичный Метод

public isRole ( string $roleName ) : boolean
$roleName string
Результат boolean

resourcePermission() защищенный Метод

protected resourcePermission ( $role, $access, $allowOrDeny )
$role
$access
$allowOrDeny

rolePermission() защищенный Метод

protected rolePermission ( $resource, $access, $allowOrDeny )
$resource
$access
$allowOrDeny

setAccess() защищенный Метод

protected setAccess ( $roleName, $resourceName, $accessName, $action ) : boolean
$roleName
$resourceName
$accessName
$action
Результат boolean

setNoArgumentsDefaultAction() публичный Метод

Sets the default access level for no arguments provided in isAllowed action if there exists func for accessKey
public setNoArgumentsDefaultAction ( integer $defaultAccess )
$defaultAccess integer Phalcon\Acl::ALLOW or Phalcon\Acl::DENY

setRedis() публичный Метод

public setRedis ( $redis, $chainRedis = false )

Описание свойств

$noArgumentsDefaultAction защищенное свойство

Default action for no arguments is allow
protected int $noArgumentsDefaultAction
Результат integer

$redis защищенное свойство

protected Redis,Phalcon\Acl\Adapter $redis
Результат Redis

$setNXAccess защищенное свойство

protected bool $setNXAccess
Результат boolean