用户权限不足时Cakephp ACL重定向 [英] Cakephp ACL redirect when a user has insufficient privileges

查看:110
本文介绍了用户权限不足时Cakephp ACL重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,您应该意识到我是一个新的蛋糕转化者。

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

好吧,根据我的判断,当用户尝试访问他们没有的网址时,足够的特权,如果Auth已登录,ACL会将其重定向到 /,如果用户尚未登录,则将其登录。并且Auth会记住请求的页面,并且成功登录后将尝试将您重定向到该页面。您没有足够的权限ACL将用户重定向到 /。我的问题是,当ACL检测到用户没有必要的特权时,是否有事件或回调可以捕获,因此我可以根据他们是哪种类型的用户来选择将用户重定向到何处。在这种情况下我正在使用基于组的权限和前缀路由。

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.

谢谢。

推荐答案

您可以检查权限,然后执行重定向 / 984 / Callbacks rel = nofollow> beforeFilter() 方法或您的控制器的 AppController (如果您的所有控制器共享此逻辑。

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.

这篇关于用户权限不足时Cakephp ACL重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆