使用Doctrine构建一个通用OO ACL [英] Building a generic OO ACL using Doctrine

查看:132
本文介绍了使用Doctrine构建一个通用OO ACL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻求设计一个自己使用的教义支持的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.

教义ORM PHP - NestedSet

这是一个可能有用的帖子:

Here is a post which may be useful too:

Zend_Acl第3部分:创建和存储动态ACLs CodeUtopia - Jani Hartikainen博客

(另见以前的两个部分)。

(take a look at the two previous parts as well).

这篇关于使用Doctrine构建一个通用OO ACL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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