CakePHP 中的 ACL
在 CakePHP 中使用 ACL 将每个用户(在注册时)添加为 ARO 的最佳方法是吗? 还有另一种方法吗?看起来如果你有足够大的用户群,它可能会放慢一点......
Is the best way to use ACLs in CakePHP to add every user (as they register) as an ARO?
Is there another way of doing it? That seems like if you got a big enough user-base it might slow it down a bit...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 ACL 会稍微减慢您的系统速度。据我所知,将它们全部添加为 ARO 是最好的方法。
如果您的系统不需要对每个方法进行细粒度控制,您可能会考虑仅使用 Auth 并使用
isAuthorized()
在方法级别对用户进行授权。这比使用 ACL 快得多,但没有 ACL 提供的细粒度控制。Using ACL will slow down your system a bit. And as far as I know, adding them all as AROs is the best way to go about it.
If you're system doesn't need fine grained control of each and every method, you might consider just using Auth and authorizing your users on a method level by using
isAuthorized()
. This is much faster than using ACL but without the fine grained control that ACL offers.ShaneK,
ARO 仅构建一次(针对每个用户)。当然,使用 ARO 和 ACO 的 ACL 实现乍一看看起来很奇怪,但当涉及到类似于稀疏矩阵的访问权限时,它绝对有其优点。
ShaneK,
the ARO are constructed only once (for each user). Sure the ACL implementation with AROs and ACOs looks strange on first sight, but it has definitely its strong points when it comes to access rights that ressemble sparse matrices.
我不知道这是否是实现“基于角色的安全系统”来控制对某些资源的访问的最佳方法,但我建议您在 USERS 表中创建一个新列来存储第一级 ARO 别名,然后您可以在您的操作中使用它来检查当前用户是否可以访问该资源。
I don´t know if it is the best way to implement a "ROLES based security system" to control access to some resources, but I would recommend you to create a new column in USERS table to store a first level ARO alias, then you could use it in your action to check if the current user can access the resource.