app/listeners/AccessListener.php: implement modules.
This commit is contained in:
parent
e5b0e1fcfd
commit
c94c0fed7b
1 changed files with 12 additions and 2 deletions
|
|
@ -34,8 +34,7 @@ class AccessListener extends Plugin
|
|||
$role = Acl::ROLE_GUEST;
|
||||
}
|
||||
|
||||
// Get the resource from controller name.
|
||||
$resource = $dispatcher->getControllerName();
|
||||
$resource = $this->_getCurrentResource($dispatcher);
|
||||
|
||||
// Ignore checks for error resource.
|
||||
if (in_array($resource, $this->_ignored_resources)) {
|
||||
|
|
@ -70,4 +69,15 @@ class AccessListener extends Plugin
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function _getCurrentResource($dispatcher)
|
||||
{
|
||||
// If default module, only fetch controller name.
|
||||
if (strlen($dispatcher->getModuleName()) < 1) {
|
||||
return $dispatcher->getControllerName();
|
||||
}
|
||||
|
||||
// Otherwise, we follow the syntax "<module>/<controller>"
|
||||
return "{$dispatcher->getModuleName()}/{$dispatcher->getControllerName()}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue