Property | Type | Description | |
---|---|---|---|
$noArgumentsDefaultAction | integer | Default action for no arguments is allow | |
$options | array |
Method | Description | |
---|---|---|
__construct ( array $options ) | Class constructor. | |
addInherit ( string $roleName, string $roleToInherit ) | ||
addResource ( Phalcon\Acl\Resource $resource, array | string $accessList = null ) : boolean | ||
addResourceAccess ( string $resourceName, array | string $accessList ) : boolean | ||
addRole ( string $role, array $accessInherits = null ) : boolean | ||
allow ( string $roleName, string $resourceName, mixed $access, mixed $func = null ) | ||
deny ( string $roleName, string $resourceName, mixed $access, mixed $func = null ) : boolean | ||
dropResourceAccess ( string $resourceName, array | string $accessList ) | ||
getNoArgumentsDefaultAction ( ) : integer | Returns the default ACL access level for no arguments provided in isAllowed action if there exists func for accessKey | |
getResources ( ) : Phalcon\Acl\Resource[] | ||
getRoles ( ) : Phalcon\Acl\RoleInterface[] | ||
isAllowed ( string $role, string $resource, string $access, array $parameters = null ) : boolean | ||
isResource ( string $resourceName ) : boolean | ||
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 |
Method | Description | |
---|---|---|
allowOrDeny ( string $roleName, string $resourceName, string $access, integer $action ) | Inserts/Updates a permission in the access list | |
getCollection ( string $name ) : MongoCollection | Returns a mongo collection | |
insertOrUpdateAccess ( string $roleName, string $resourceName, string $accessName, integer $action ) : boolean | Inserts/Updates a permission in the access list |
public addInherit ( string $roleName, string $roleToInherit ) | ||
$roleName | string | |
$roleToInherit | string |
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']);
$acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultor');
$acl->addRole('administrator', 'consultor');
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 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');
protected getCollection ( string $name ) : MongoCollection | ||
$name | string | |
return | MongoCollection |
public getNoArgumentsDefaultAction ( ) : integer | ||
return | integer |
public getResources ( ) : Phalcon\Acl\Resource[] | ||
return | Phalcon\Acl\Resource[] |
public getRoles ( ) : Phalcon\Acl\RoleInterface[] | ||
return | Phalcon\Acl\RoleInterface[] |
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 isResource ( string $resourceName ) : boolean | ||
$resourceName | string | |
return | boolean |
public setNoArgumentsDefaultAction ( integer $defaultAccess ) | ||
$defaultAccess | integer | Phalcon\Acl::ALLOW or Phalcon\Acl::DENY |
protected int $noArgumentsDefaultAction | ||
return | integer |