有什么好的 PHP 权限框架可以列出资源?
我正在构建一个新的应用程序,我需要一个权限框架来配合它。 下面是我们需要它支持的其中一项功能的简单示例:
使用数据模型:
user
----
id
role
type
resource
----
id
name
type
我们希望能够设置一个访问规则,规定用户可能只知道与他们具有相同类型的所有资源,除非他们具有管理员角色(在这种情况下他们可以看到一切)。然后我们希望能够提取“该用户知道的所有资源”的可搜索/可分页列表。 (假设有 500,000 个资源。)
我尝试将其硬塞到 Zend_acl 中,但是虽然我认为我可以在 zend_acl 中定义所有规则,但它是基于逐个资源的基础上的,并且没有适当的支持来获取 < em>列出资源,而且肯定不是以内存友好的方式(例如一次显示 10 个资源和分页)。
那么,什么是支持此类基于关系的规则(而不是列表)的良好 PHP 权限框架呢?
I'm building a new application and I need a permission framework to go along with it.
Here's a quick example of one of the things we need it to support:
With the data model:
user
----
id
role
type
resource
----
id
name
type
We want to be able to set up an access rule that says a user may only know about all resources with the same type as them, unless they have a role of admin (in which case they can see everything). And then we want to be able to pull a searchable/pageable list of "All resources this user knows about". (Let's say there's 500,000 resources.)
I tried to shoe-horn this into Zend_acl, but while I think I can define all the rules in zend_acl, it's on a resource-by-resource basis, and there's no proper support for getting a list of resources out of it, and certainly not in a memory-friendly way (such as showing 10 resources at a time and paging).
So what is a good PHP permission framework that supports relationship-based rules (as opposed to lists) such as these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也许仍然可以使用 ACL,只要它可以扩展以满足您的目的。例如,Zend_Acl 允许您 编写您的自己的 ACL 断言,可用于覆盖基于资源的行为。您还可以扩展 Zend_Acl 以提供该用户可用的所有资源的列表。
You might still be able to use an ACL, provided that it can be extended to suit your purposes. For instance, Zend_Acl allows you to write your own ACL assertions that can be used to override the resource-based behaviour. You could also extend Zend_Acl to provide the list of all resources available to that user.