Wednesday, March 28, 2012

isAuthorized() is never called

Hi,

When I run a action, the access is refused because the method
isAuthorized() is never called.

AppController :

<?php

class AppController extends Controller {

public $helpers = array ('Html', 'Form', 'Session', 'Time');

public $components = array('Session', 'Auth');

public function beforeFilter()
{
$this->Auth->userModel = 'User';
$this->Auth->fields = array('username' => 'username', 'password' =>
'password');
$this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->loginRedirect = '/';
$this->Auth->loginError = 'Nom d\'utilisateur ou mot de passe
incorrects.';
$this->Auth->logoutRedirect = '/';
$this->Auth->authError = 'Vous n\'avez pas accès à cette page.';
$this->Auth->autoRedirect = true;
$this->Auth->authorize = 'controller';

debug('beforeFilter');
}

public function isAuthorized($user = null)
{
debug('isAuthorized');
die();
return true;
}
}

My others controllers do not implement beforeFilter or isAuthorized.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: