我想为不同的模块设置不同的访问权限。
我试过了
$this->allow($role, $module, $controller, $action);
或
$this->allow($role, $module . ':' . $controller, $action);
但这似乎并不管用。
有什么想法吗?
发布于 2011-04-17 07:56:50
要正确设置acl,您需要定义roles、resources和permissions。
例如。
$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'));
这是一个基于模块的结构。所以首先你要定义一个角色。然后定义默认的模块资源。索引是IndexController。最后,将guest类型的用户应该能够访问的操作设置为数组。
你问题中的第二行代码看起来没问题,所以其他地方可能会有问题。查看一些资源:
文档:
如何:
https://stackoverflow.com/questions/5692093
复制