isAuthorized() 메서드를 사용하여 관리 플래그를 확인하려고하지만 함수가 호출 된 적이없는 것 같습니다. false를 항상 반환하도록 함수를 설정하더라도 모든 사용자가 허용합니다. 그것은 부름을받지 않은 것처럼 보입니다.cakephp isAuthorized()가 호출되지 않음
$ this-> Auth-> authorize = 'controller'를 설정하는 것 이상을해야합니까?
에서
class AppController extends Controller
{
var $components = array('Auth');
function beforeFilter()
{
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'pages', 'display' => 'home');
$this->Auth->logoutRedirect = '/';
$this->Auth->authorize = 'controller';
$this->Auth->userScope = array('User.active' => 1);
}
function isAuthorized()
{
if (strpos($this->action, "admin_") != false)
{
if ($this->Auth->user('isAdmin') == '0')
{
return false;
}
}
return true;
}
}
나는 beforeFilter()를 재정의하고 parent :: beforeFilter()를 호출하지 않았다. –