2013-02-16 34 views
0

我跟着教程,并没有得到任何错误,但acl是允许所有用户的所有行动。我检查与aclmanager所有权限正在正确显示。我已经添加了父:: beforeFilter( );在所有的控制器中。我错过了什么?任何人都可以帮我解决这个问题吗?Cakephp 2 acl不否认任何行动

这是我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的

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

你确定你已经启用了ACL组件我beforefilter功能?

检查AppController了一段时间,如:

public $components = array(
     'Acl', 
     'Auth' => array(
      'authorize' => array(
       'Actions' => array('actionPath' => 'controllers') 
      ) 
     ), 
     'Session' 
); 
+0

另外,请确保您的ACL数据库表,如'acos'被填充。 – input 2013-02-16 14:20:23

+0

是的,我检查了Acl组件已启用,并且acos,aros,aros_acos表被填充。 – 2013-02-17 07:14:56