I have acl based CakePHP app and users are belong to groups.
Please开发者_如何学C advice me where I should implement the redirection code by user's group:
- users belong to admin group redirect to
admin/dashboard
- users belong to manager group redirect to
manager/dashboard
- users belong to user group redirect to
user/dashboard
set $this->Auth->autoRedirect = false;
in beforeRedirect() in users controller
In the login() function:
if ($this->Auth->user()){ $this->redirect(array('prefix'=>$this->Auth->user('group'),'controller'=>'dashboard','action'=>'index')); }
This code is just example to show how it is done, not to be taken as-is.
精彩评论