我们通过拥有管理员面板和其下的多名员工进行应用。 员工只能看到数据并编辑和更新它。 我已经学习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