| Subject: | Re: isAuthorized() is never called |
|---|---|
| From: | daf182 |
| Date: | Thu, 29 Mar 2012 12:42:10 -0700 PDT |
|
Hi, I wrote this code moths ago: abstract class AppController extends Controller { //... public $components = array( 'Session', 'Auth' => array( 'loginRedirect' => array('controller' => 'pages', 'action' => 'index'), 'logoutRedirect' => array('controller' => 'abouts', 'action' => 'index'), 'authorize' => array('Controller'), 'authError' => "You are not authorized to view this page." ) ); function beforeFilter() { $this->Auth->allow('index'); $this->set('userId', $this->Auth->user('id')); $this->set('userRole', $this->Auth->user('role')); $this->set('userName', $this->Auth->user('username')); $this->set('isLoggedIn', $this->Auth->loggedIn()); } public function isAuthorized($user) { if (isset($user['role']) && $user['role'] === 'admin') { return true; //Admin can access every action } return false; // The rest don't } } 2012. mÃrcius 28., szerda 15:09:03 UTC+2 idÅpontban Sony a kÃvetkezÅt Ãrta: Hi, 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@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Cost of cakePHP2 developers, Miles J |
|---|---|
| Next by Date: | Re: CakePHP Controller Testing with DB Sessions, jcrens8392 |
| Previous by Thread: | isAuthorized() is never called, Sony |
| Next by Thread: | Call to a member function setState() on a non-object, Neeraj kumar |
| Indexes: | [Date] [Thread] [Top] [All Lists] |