05.21
php
saved
aarkerio
Note
Using Auth in this way, is correct?
Using Auth in this way, is correct?
- File: APP/app_controler.php
- public function beforeFilter()
- {
- $this->Auth->logoutRedirect = '/news/display';
- $this->Auth->loginError = 'Invalid e-mail / password combination. Please try again';
- $this->Auth->authorize = 'controller';
- $this->Auth->deny('*');
- $this->set('cU', $this->Auth->user()); // $cU current user array to use in the views if user logged in
- }
- in controller:
- public function beforeFilter()
- {
- parent::beforeFilter();
- }
- public function isAuthorized()
- {
- if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ): // admin and teachers
- return true;
- else:
- return false;
- endif;
- endif;
- return true;
- }
Parsed in 0.085 seconds, using GeSHi 1.0.7.14