2013-02-16 54 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