I have an admin routing set up for manage_action
Pretty much all the functions after baking the original controller functions
have
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid User', true));
$this->redirect(array('action' => 'index'));
}
Now in most of my functions I have
function manage_add()
{
$id = $this->Auth->user('id');
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid User', true));
$this->redirect(array('action' => 'index'));
}
.......
.......
}
I realy do not need the if() block anymore because in order to access the
manage_anything they have to be logged in so the $id will never be empty
right?
beforeFilter checks:
$manage = Configure::read('Routing.manage');
if (isset($this->params[$manage]) && $this->params[$manage]) {
$this->__checkManagerSession();
}
function __checkManagerSession()
{
if (empty($this->Auth->user('id')) || $this->Auth->user('role') !=
'manager') {
$this->Session->destroy();
$this->redirect('/users/login');
exit();
}
}
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---