On Tue, May 26, 2009 at 11:02 AM, Teh Treag <[email protected]> wrote:
>
> in your app_controller::beforeFilter(){
>    $this->Auth->loginRedirect=array
> ('controller'=>'users','action'=>'home');
> }
>
> in users_controller::home(){
>    $userinfo=$this->Auth->user(); // assuming the group is in there
>    switch($userinf['User']['Group']){
>        case 'admin': $url=array('controller'=>'users',
> 'admin'=>true);
>                             break;
>        case 'user': $url=array('controller'=>'users');
>                          break;
>        default: $url='/users';
>    }
>    $this->redirect($url);
> }
>

In this case, you'd have 2 redirects, one from login, and a 2nd from home().

I've got a similar situation. There are just 2 different locations to
deal with--whether the user is an admin or not--but the principle is
the same.

In AppController, I set the general redirect locatio


if ($this->Auth->user('group_id') > 3)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to