我希望设计一个由原则支持的 ACL 系统供我自己使用,尽管我在一些最初的设计考虑方面遇到了困难.
I'm looking to design a doctrine-backed ACL system for my own use, although I'm struggling with some of the initial design considerations.
现在我正在考虑根据类和唯一标识符来制作它,并将它们存储在一个表中:
Right now I'm looking at making it based on classes and unique identifiers, storing them in a table as such:
Table: ACL
ResourceClass
ResourceKey
RoleClass
RoleKey
Permission
显然,这将要求我对正在查询的类进行内省以派生正确的 ResourceClass 值.
Obviously this is going to demand that I introspect on classes that are being queried to derive the correct ResourceClass values.
我想知道这种方法以前是否已经使用过,或者是否有人对以更好的方式进行操作有一些建议.角色之间的递归关系等其他事情也让我感到困惑,因为我不确定如何递归查询以构建资源和 ACL.
I'm wondering if this approach has been done before or if anyone has some advice with doing it in a bettery way. Other things like recursive relationships between Roles also confound me as I'm not sure how to recursively query to build and ACL for a Resource.
我不是 Zend ACL 的忠实拥护者,因此请不要提出任何建议 - 我知道!
I'm not a huge fan of Zend ACL, so please no suggestions for it - I am aware of it!
随着人们的加入,我们会进一步澄清这个问题,所以请多多包涵!这个问题本身可能需要几次迭代!;)
Further clarifications will be made to this question as people weigh in, so please bear with me! This question itself may require a few iterations! ;)
我使用 NestedSet 来存储 ACL 层次结构和缓存以加快速度.
I use NestedSet for storing the ACL hierarchy and cache to speed things up.
Doctrine ORM for PHP - NestedSet
这是一个可能也有用的帖子:
Here is a post which may be useful too:
Zend_Acl 部分3:创建和存储动态ACL |CodeUtopia - Jani Hartikainen 的博客
(也请看前两部分).
这篇关于使用 Doctrine 构建通用 OO ACL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!