Zend’s Acl allows the resource to be created in controller only
But, the controllers might be on any module not just only the default module. So, I read some article off the internet, I found one and tried this:
$acl -> addResource(new Zend_Acl_Resource("admin"));
$acl -> addResource(new Zend_Acl_Resource("admin:page"), "admin");
$acl -> addResource(new Zend_Acl_Resource("admin:posts"), "admin");
But, still, when i browse to the respective pages, I get errors regarding resouce page not found, or posts not found.
How to setup Module Specific ACL Resource?
Update:
$acl -> addrole(new Zend_Acl_Role('guest'))
-> addrole(new Zend_Acl_ROle('admin'), 'admin');
$acl -> addResource(new Zend_Acl_Resource("page")); //controller with same name in admin module exists
$acl -> addResource(new Zend_Acl_Resource("admin"));
$acl -> addResource(new Zend_Acl_Resource("admin:page"), "admin");
$acl -> addResource(new Zend_Acl_Resource("admin:posts"), "admin");
$acl -> deny(null, null);
$acl -> allow('user', 'page', 'view');
$acl -> allow('admin', null);
I’m guessing the code you posted was some sort of pseudo code, as it wasn’t valid. Still, this answer should work perfectly fine as is.