zend $ acl-> has()recource bt $ acl-> isAllowed返回false

时间:2014-02-18 13:35:49

标签: zend-framework zend-acl

我遇到了zend_acl的一个奇怪问题,我已经成功添加了角色和资源,但isAllowed()函数总是重定向到错误控制器。

$usersNs->role = 'admin';

$acl->addRole(new Zend_Acl_Role($usersNs->role));
$acl->add(new Zend_Acl_Resource("dashboard::stats"));

$privilageName = $request->getControllerName()."::".$request->getActionName();

if($acl->has($privilageName)){
    echo "has privelage";    //echo every time whenever i go to dashboard,stats
}

if(!$acl->isAllowed($usersNs->role,$privilageName )) {
    $request->setControllerName('error');
    $request->setActionName('error');
}

0 个答案:

没有答案