I have different users groups e.g. admin, author,publisher and have separately controllers for them I want to set default path after login on base of
$this->Auth->User('group_id')
like this in appcontroller in beforefilter() method
if ($this->Auth->User('group_id') == '1')
{
Router::connect('/', array('controller' => 'admin', 'action' => 'index'));
}
elseif($this->Auth->User('group_id') == '2')
{
Router::connect('/', array('controller' => 'author', 'action' => 'index'));
}
else {
Router::connect('/', array('controller' => 'publisher', 'action' => 'index'));
}
I tried this in
routes.php
in Config using $_SESSION Variable because in that file couldnt use $this. Main purpose is that when user login it will take to their controller and so i can have clean URL I dont want to same controller i have to use check for group than ACL library's power will be in waste. Any Help will be appreciated to accomplish this. Thanks in advance