, .
, , Zend_Acl, - (), . "", , "". "login-button", "logout-button", Zend_Navigation.
In your case, you should define the resource (in acl) as some string that can be displayed on the module / controller layout. For example, for the foo module and control panel, specify the resource "foo.bar". Then, in the access control procedure, you will read the name of the module and the controller and combine them into a string to obtain a resource.
In an example example:
class Application_Plugin_AccessCheck extends Zend_Controller_Plugin_Abstract {
...
public function preDispatch(Zend_Controller_Request_Abstract $request){
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
...
$resource = $module . '.' . $controller;
...
$role=NULL;
if($this->_auth->hasIdentity()){
$identity = $this->_auth->getStorage()->read();
$role = $identity->role;
}
...
if(!$this->_acl->isAllowed($role, $resource, $action)){
}
}
}
source
share