php - CakePHP 2.4.5 Auth - isAuthorized not being called -
this may repeated question have gone through other answers , none of them worked me :(
the following code in appcontroller:
public $components = array( 'auth', 'session' ); public function beforefilter() { $this->auth->authorize = 'controller'; $this->auth->authenticate = array( 'form' => array( 'fields' => array('username' => 'email', 'password' => 'password'), 'scope' => array('user.active' => 1), 'passwordhasher' => 'blowfish' ) ); } public function isauthorized($user) { debug($this->request->params); exit; }
i not overriding beforefilter or isauthorized function in of other controllers. no matter page open not calling isauthorized function , taking me login page. please help!
authorization checks made after successful authentication, see authcomponent::startup()
.
public function startup(controller $controller) { // ... // authenticate first if (!$this->_getuser()) { return $this->_unauthenticated($controller); } // authorize if ($this->_isloginaction($controller) || empty($this->authorize) || $this->isauthorized($this->user()) ) { return true; } // ... }
so solution should log in first.
Comments
Post a Comment