app/library/Acl.php: in isAllowed() implement wildcard for controllers in modules.
This commit is contained in:
parent
c94c0fed7b
commit
2cb7ad2da8
1 changed files with 13 additions and 0 deletions
|
|
@ -33,6 +33,19 @@ class Acl
|
||||||
*/
|
*/
|
||||||
public function isAllowed($role, $resource)
|
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;
|
return $this->_adapter->isAllowed($role, $resource, 'All') == \Phalcon\Acl::ALLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue