我无法找到解决我的问题的方法。 我有一个使用Auth组件和ACL组件的CakePHP网站。 我不希望不活动的用户能够登录。Auth和ACL在CakePHP中有条件
我发现user身份验证组件可以做到这一点。 所以在我AppController中的beforeFilter里面,我添加了这个:
$this->Auth->userScope = array('User.active' => 1);
当然,在我的UserController的beforeFilter,父方法的调用。
但是,这并不worj,我仍然能够登录与积极设置为0的用户。 我认为这可能是因为ACL组件?
这是我在beforFilter AppController的
public function beforeFilter()
{
if (!$this->Session->check('Auth.User'))
$this->layout = 'identification';
$this->Auth->allow('display');
//Configure AuthComponent
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'welcome');
$this->Auth->userScope = array('User.active' => 1);
}
我缺少什么?
U是否使用cakePHP 2.0或1.3? –
我正在使用CakePHP 2.0 – azerto00