我遵循了教程,并没有得到任何错误,但acl允许所有用户的所有操作。我检查了aclmanager所有权限正在正确显示。我添加了parent :: beforeFilter();在所有控制器。我错过了什么?有人可以帮我解决这个问题吗?
这是我的initDB功能
public function initDB() {
$group = $this->User->Group;
$group->id = 1;
$this->Acl->allow($group, 'controllers');
$group->id = 2;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Employees');
$group->id = 3;
$this->Acl->deny($group, 'controllers');
//we add an exit to avoid an ugly "missing views" error message
echo "all done";
}
这是我在appcontroller中的beforefilter函数
function beforeFilter(){
$this->Auth->authorize = array(
'Controller',
'Actions' => array('actionPath' => 'controllers')
);
$this->Auth->authenticate = array('Form' => array('fields' => array('username' => 'username', 'password' => 'password')));
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'employees', 'action' => 'employee_list');
}
答案 0 :(得分:0)
您确定已启用acl组件吗?
请查看AppController
一段时间,如:
public $components = array(
'Acl',
'Auth' => array(
'authorize' => array(
'Actions' => array('actionPath' => 'controllers')
)
),
'Session'
);