문제점에 대한 해결책을 찾을 수 없습니다. 인증 컴포넌트와 ACL 컴포넌트를 사용하는 CakePHP 웹 사이트가 있습니다. 활성 상태가 아닌 사용자가 로그인 할 수 없도록하고 싶습니다.CakePHP에서 조건을 가진 Auth 및 ACL
Auth 구성 요소에서 userScope을 사용할 수 있습니다. 은 그래서 으로, beforeFilter 안에 내 의 AppController에, 난이 추가 내 UserController으로, beforeFilter에 물론
$this->Auth->userScope = array('User.active' => 1);
를, 부모의 메소드를 호출한다.
그러나 이것은 걱정할 필요가 없습니다. 0으로 설정된 활성 사용자로 로그인 할 수 있습니다. ACL 구성 요소 때문일 수 있습니다. 여기
내가 놓친 게 무엇
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);
}
의 AppController
내 beforFilter입니까? 당신이 그것을하지 않으면
cakePHP 2.0 또는 1.3을 사용하고 있습니까? –
CakePHP 2.0을 사용하고 있습니다. – azerto00