Setting up different access for different modules

I want to set different access for different modules.

I tried

$this->allow($role, $module, $controller, $action); 

or

 $this->allow($role, $module . ':' . $controller, $action); 

But that does not work.

Any ideas?

+4
source share
1 answer

To properly configure acl, you need to define roles , resources, and permissions .

eg.

 $this->addRole(new Zend_Acl_Role('guests')); $this->add(new Zend_Acl_Resource('default')) ->add(new Zend_Acl_REsource('default:index'), 'default'); $this->allow('guests', 'default:index', array('index', 'error')); 

This is a module-based structure. So, first you define the role. Then you define the module resource, which is the default. Index - IndexController. And finally, you specify the actions that the guest user must have access to the array.

The second line of code in your question looks fine, so there may be a problem elsewhere. Check out some resources:

Documentation: Zend_Acl

How to do it: Zend Framework 1.8 tutorial 5 zend_acl with zend_auth and a controller plugin

+3
source

All Articles