开发者

Redirect to dashboard by user's group

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜