diff --git a/app/library/Acl.php b/app/library/Acl.php index 80a3157..b7814b7 100644 --- a/app/library/Acl.php +++ b/app/library/Acl.php @@ -33,6 +33,19 @@ class Acl */ public function isAllowed($role, $resource) { + // Special stuff here :) for resources within modules. + + // Modules and controllers are separated by "/" + $pos = strpos($resource, '/'); + if ($pos !== false) { + // Construct the wildcard resource. + $wildcard = substr($resource, 0, $pos+1) . '*'; + + // If we have this wildcard resource, check against that instead. + if ($this->hasResource($wildcard)) { + $resource = $wildcard; + } + } return $this->_adapter->isAllowed($role, $resource, 'All') == \Phalcon\Acl::ALLOW; }