Cakephp ACL redirect when a user has insufficient privileges

折月煮酒 提交于 2019-12-11 07:28:24

问题


First you should be aware that I am a new cake convert.

Ok, from what I can tell when a user try's to visit a url they do not have sufficient privileges for, the ACL redirects them to "/" if Auth has loged them in, and login if the user is not already loged in. Also Auth remembers the requested page and on a successful login will attempt to redirect you there, again if you do not have sufficient privileges ACL redirects the user to "/". My question is when the ACL detects that the user does not have the necessary privileges, is there an event or a callback I can catch so I can choose where the user is redirected based on what type of user they are etc. In this particular case I'm using group based permissions and prefix routing.

Thanks.


回答1:


You could check for permissions and do the redirect in the beforeFilter() method of your controller or in the AppController if this logic is shared by all of your controllers.



来源:https://stackoverflow.com/questions/3953035/cakephp-acl-redirect-when-a-user-has-insufficient-privileges

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!