如何根据 CakePHP 中的权限将用户路由到不同的功能?
这可能以前被问过,我也见过类似的解决方案......也许我对这个问题的思考是错误的。
我想要一个名为 user/edit 的链接,如果用户是管理员,则应该路由到 admin_ 如果他们是基本用户,则应该路由到 user_ 等等...有没有一种方法可以巧妙地做到这一点?
我见过类似的解决方案,就像在 user/admin_edit 中输入一样,它会带你去用户/编辑...
This may have been asked before, and I have seen similar solutions... Perhaps I am thinking about this incorrectly.
I would like to have one link called user/edit if the user is an admin it should route to admin_ if they are a basic user it should route to user_ etc... Is there a way to do this in a slick way?
I have seen solutions that kind of do the opposite like type in user/admin_edit and it takes you to user/edit...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要查看前缀路由。
http://book.cakephp.org/view/544/Prefix-Routing
将其与 Auth/ACL 中内置的 Cakes 结合起来,您应该没有问题。
You will want to take a look at prefix routing.
http://book.cakephp.org/view/544/Prefix-Routing
Combine this with Cakes built in Auth/ACL and you should have no problem.