interesting ...

maybe, you can try (not very clever and effective way) :
after login redirect user to 'Redirect_page' (for both groupd) - with
standart Auth functionality ... there, dont create view ... just in controll
function define redirecting according to group ->

it will look like this :

Login Page with formular -> Automatic Login Page (without view - just
redirect user to correct page) -> Correct page
users/login -> users/logged_user -> users/page1 OR users/page2

2011/1/8 eldorado2768 <davidbrotman2...@gmail.com>

> I tried your suggestion. I created the before filter in the app
> controller as shown below:
>
> class AppController extends Controller {
>
> var $helpers = array('Form', 'Html', 'Javascript',
> 'Time','Menu','Session');
> var $components = array('Acl','Auth','Session');
>
> #  //Configure AuthComponent
> function beforeFilter() {
>  $this->Auth->authorize = 'actions';
>  $this->Auth->loginAction = array('controller' => 'users', 'action' =>
> 'login');
>  $this->Auth->logoutRedirect = array('controller' => 'users', 'action'
> => 'login');
> $groupmember = $this->Session->read('Auth.User.group_id');
> if($groupmember=='1')
> $this->Auth->loginRedirect = array('controller' => 'users', 'action'
> => 'index');
> else
> $this->Auth->loginRedirect = array('controller' => 'tenants', 'action'
> => 'tenantview');
>  }
> }
>
> This produces a much more serious error with the whole page going
> white:
>
> Warning (512): AclNode::node() - Couldn't find Aro node identified by
> "Array
> (
>    [Aro0.model] => User
>    [Aro0.foreign_key] => 4d2508cb-cd40-48c6-b93d-40c945591691
> )
> " [CORE/cake/libs/model/db_acl.php, line 191]
>
>
> On Jan 7, 2:53 pm, Martin Duris <mato.du...@gmail.com> wrote:
> > i guess, problem might be here :
> > in app_controller you define login redirect (according to standart use of
> > Auth from tutorial)
> >
> > $this->Auth->loginRedirect = array('controller' => 'projects', 'action'
> =>
> > 'index');
> >
> > you should take care of login redirect here (maybe edit it or bypass)
> >
> > 2011/1/7 eldorado2768 <davidbrotman2...@gmail.com>
> >
> > > I am trying to redirect to different locations depending on which
> > > group a user belongs to after logging in. The problem I am having is
> > > that it keeps going to the redirect for group 1 even when it should be
> > > going to the redirect for group 2:
> >
> > > function login()
> > >  {
> > > $this->layout = 'login';
> > > if ($this->Auth->user())
> > >  {
> > > $groupmember = $this->Session->read('Auth.User.group_id');
> > > if($groupmember==1)
> > > $this->Auth->loginRedirect = array('controller' => 'users', 'action'
> > > => 'index');
> > > else
> > > $this->Auth->loginRedirect = array('controller' => 'tenants', 'action'
> > > => 'tenantview');
> > >  }
> >
> > >  }
> >
> > > I have confirmed that the group_id is being picked up by the session
> > > variable by displaying it on the redirected view so I know at least
> > > the variable is not empty.
> >
> > > Anyone have a clue what I am doing wrong here?
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > 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<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>>For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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