> when I call Zend_Acl's isAllowed(..) method with a role, resource, or
> privilege that is not specified I would say it would return false, but that
> does not seem to happen. It does not seem to return at all, or am I doing
> something wrong?
>
> my code:
>
> echo 'one';
> if(!$this->_acl->isAllowed('blabla' ,'auth', 'login')){
> echo 'two';
>
> $request->setControllerName('authentication')->setActionName('unauthorized'
> ); }
> echo 'three';
>
> // one is shown, two and three not
Afaik throws Zend_Acl an exception when you're trying to get allowance for a
role and/or resource that is not set. The proper flag whether you can continue
is this:
($acl->hasRole($role) && $acl->has($resource) && $acl->isAllowed($role,
$resource, $permission))
The combined check of role, resource and isAllowed gives the final true/false.
In this case you got an exception and probably saw nothing because you do not
catch this exception properly.
Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com
没有评论:
发表评论