I am using acl and I want to redirect the users based on which group they are from
in my appcaontroller I have this
public function beforeFilter() {
//Configure AuthComponent
//$this->Auth->allow('display');
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'posts', 'action' => 'add');
}
what should I do so if the user is from group_id 1, he/she should be redirected to a place different than group_id = 4 etc
thanks
Okay so for example you are redirecting every user to an action say
dashboard. Instead of redirecting the user to add action ofpostscontroller redirect todashboardofuserscontroller. I am assuming you have another table for groups and you are keeping it’s foreign key in users table.The above will redirect user upon login to
dashboardaction inuserscontroller. Now to take every user to a specific group, get the group name of user and redirect to specific page.So the above code will take every user to specific action e.g. if group name is ‘managers’ user will be redirected to ‘managers_dashboard’.