我們通過擁有管理員面板和其下的多名員工進行應用。 員工只能看到數據並編輯和更新它。 我已經學習ACL組件,但我不能正確理解它,我們可以得到另一個 鏈接。在cakephp中擁有多個用戶的管理員面板
So I have store role admin , employee.
On user controller when users login it checks whether it is admin or employee
But it is not working can you suggest whats the problem in code.
public function beforeFilter()
{
parent::beforeFilter();
$userDetail=$this->Auth->request->data['User'];
$role = $this->User->findByEmail($userDetail['username']);
if($role['User']['role'] == "admin") {
$this->Auth->allow('*');
}else {
$this->Auth->allow('add','edit');
}
您也可以按照[TinyAuth](http://www.dereuromark.de/2011/12/18/tinyauth-the-fastest-and-easiest- for-cake2 /)和[common-cakephp-problems-and-solutions](http://www.dereuromark.de/2011/10/05/common-cakephp-problems-and-solutions/)控制器侵入方法。 – mark
我在代碼中看不到任何ACl。如果你的應用程序很簡單,可以聽Fazel – Fury