AclManager
class AclManager extends BaseManager
Provides passthrough and simplified methods for ACL management
Methods
Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets
No description
No description
No description
Completely remove a role
No description
No description
Create a new ACL resource
Create a role (group) for the ACL Data is provided as an array with * name * description (optional)
Allow action on resource
Deny action on resource
Add action to resource
Remove an action from a resource
Fetch all access control lists, organized by resource
[
'ResourceName' => ['action1', 'action2'],
.
Get all actions for a given role
[
'ResourceName' => [
['action' => 'action1', 'allowed' => 0],
['action' => 'action2', 'allowed' => 1],
],
.
Details
in BaseManager at line line 23
object
save(object $obj)
Save handler, because DRY
in BaseManager at line line 60
Paginator
getPaginator(integer $page = 1, integer $limit = 50)
Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets
Because it's based on Phalcon's QueryBuilder, it supports a fluent filtering interface:
$manager = $this->foo_manager; $items = $manager->getPaginator(1, 20) ->orderBy('created_at desc') ->where('name = :name:', array('name' => $name)) ->andWhere('type = :type:', array('type' => $type)) ->paginate(); echo json_encode($items);
in BaseManager at line line 80
boolean
restDelete(number $id)
Delete an object with rest
in BaseManager at line line 103
restCreate(array $data)
Create a new object
in BaseManager at line line 117
restUpdate(int $id, array $data)
Update an existing object
at line line 20
static
find($params = null)
at line line 25
static
findFirst($params = null)
at line line 30
static
findFirstByName($name)
at line line 40
boolean
delete(string $name)
Completely remove a role
at line line 53
update($name, $input)
at line line 84
create($input)
at line line 138
Resource
createResource(array $input)
Create a new ACL resource
Array contains: * name * actions
$manager = $di->get('acl_manager'); $manager->createResource([ 'name' => 'IndexResource', 'actions' => ['index', 'create', '*'] ]);
at line line 181
boolean
createRole(array $input)
Create a role (group) for the ACL Data is provided as an array with * name * description (optional)
$manager = $di->get('core_manager') $manager->createRole([ 'name' => 'DefaultRole', 'description' => 'Something here' ]);
at line line 203
allow(string $role, string $resource, array $actions)
Allow action on resource
at line line 218
deny(string $role, string $resource, array $actions)
Deny action on resource
at line line 232
addResourceAction(string $resource, string $action)
Add action to resource
at line line 253
dropResourceAction(string $resource, string $action)
Remove an action from a resource
at line line 270
array
getLists()
Fetch all access control lists, organized by resource
[
'ResourceName' => ['action1', 'action2'],
.
.. ]
at line line 305
array
getActionsForRole(string $role)
Get all actions for a given role
[
'ResourceName' => [
['action' => 'action1', 'allowed' => 0],
['action' => 'action2', 'allowed' => 1],
],
.
.. ]