如何根据 CakePHP 中的权限将用户路由到不同的功能?

发布于 2024-08-17 10:01:40 字数 208 浏览 1 评论 0原文

这可能以前被问过,我也见过类似的解决方案......也许我对这个问题的思考是错误的。

我想要一个名为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-08-24 10:01:40

您将需要查看前缀路由。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文