This doesn't work for me. I added the redirekt in app_controller and
create a new function home() in users_controller:
function home()
{
$userinfo = $this->Auth->user(); // assuming the group is in
there
switch($userinfo['User']['group_id'])
{
case '1': $this->redirect(array (
'controller' => 'members',
'action' => 'index'), null, true);
break;
case '4': $this->redirect(array (
'controller' => 'members',
'action' => 'otherList'), null,
true);
break;
default: $this->redirect(array (
'controller' => 'members',
'action' => 'index'), null, true);
}
}
If I first login as member of group '4', all the redirection is
correct. After logout and login as member of group '1' I get the same
redirection as before. Not the expected redirection to /members/
index.
Whats going wrong here?
draikin
Teh Treag schrieb:
> 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);
> }
>
> How something like that?
>
> -teh
>
> On May 26, 9:15 am, draikin <[email protected]> wrote:
> > Hi,
> >
> > for my cakePHP application I use the acl to handle authentication and
> > authorisation. For this purpose I have 3 groups who have different
> > rights for the application.
> > Now I want to redirect the user after successful login, dependent on
> > his group, to different actions in my application.
> > And I don't know how to do this. I try to do it in the app_controller
> > and the users_controller with no success. I try to get the group and
> > then redirect to the specific action. But this doesn't work.
> > What is the right or the cake way to do this simple thing? I think I
> > miss something, but I don't find anything on this issue. Any help or
> > hint would be appreciated. A code example would be very nice.
> >
> > Thank you for your help, and sorry for my bad English
> > draikin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---