Reputation: 35
I would like to add ACL to my ZF2 application, but I've a problem with adding permissions for all actions in the controller.
I can do this:
$acl->allow('roleName','zfModule', 'controllerName:actionName');
but not so
$acl->allow('roleName','zfModule', 'controllerName:all');
How can I do this?
Upvotes: 3
Views: 3388
Reputation: 12809
If you want to allow access to ALL resources:
$acl->allow('role_name', NULL);
Allow all privileges on your particular resouce:
$acl->allow('role_name', 'zfModule', NULL);
You could then use your action names as privileges when you build the ACL.
// allow a user to read and create on this controller
$acl->allow('role_name', 'zfModule/MyController', array('read', 'create', 'delete'));
You can treat your controller as the resrouce and each action as a privilege.
You can alternatively treat each controller/action or route as a resource, it's down to you.
Upvotes: 6