I am having issues setting up different redirects for a logged in
user. Basically, there are two user levels, ADMIN and USER. If a USER
logs in I want to redirect them to the a different page than an admin.
I have tried using switch statements and tried using the normal $this-
>redirect function but couldn't get either working.

I tried putting this:

switch($this->Auth->User("level"))
    {
    case "ADMIN" :
      $this->redirect(array('controller' => 'users', 'action' =>
'index'), null, true);
      break;

    case "USER" :
      $this->redirect(array('controller' => 'clients', 'action' =>
'index'), null, true);
      break;
    }

in the beforeFilter of AppController but it doesn't work. I already
have this in there.

  function beforeFilter()
  {
    $this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
//    $this->Auth->loginRedirect = array('controller' => 'users',
'action' => 'index');
    $this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
    $this->Auth->authError = "-- Invald Access --";
    $this->Auth->loginError = '-- Invalid Login --';
  }


I don't know what else to do. I think I could figure out a hack around
this but I was more wondering if there is a proper 'cake' way of doing
this. Any help is most appreciated.

Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to