Long story short: why does Zend ACL support multiple inheritance among roles and not resources?
I have a large tree of resources that I would like to be able to grant permissions on. In the past, what I have done to represent this is creating two different trees. The first one has a generic resource of each type in a tree. The second has all the instances of these types, arranged in the same manner. It would mean that if you were to super impose the trees you would find objects of the same type on the same level. Then, each object instance is set to have it's generic object from the first tree as an additional parent. This allows me to set default permissions for every type of object, so each instance will inherit them instead of me having to define them, but still gives me refined, specific access to each instance.
An example:
A site has 3 modules: users, where user profiles and whatnot are stored. forums, where lively discussions about current issues take place galleries, where users can upload photos of their pets
So, the generics tree mentioned above would look like this:
module / | \ user forum gallery / | \ profile topic photo | post
And the instances tree would look like this:
module_1 / / / | \ \ user1 user2 user3 forum gallery1 gallery2 | | | / \ / \ / \ profile profile profile sub1 sub2 photo photo photo photo | / \ post1 post2 post3
And in the ACL each user object instance would inherit from user in the first tree. So be default I want to make everything readable, so I allow read on module. Everything inherits from module, so it's all good. I also want users to be able to edit their profiles, so I grant edit to each user on their respective profile, the generics tree doesn't help here. Lets say my photo galleries are NSFW, so I want to deny read on them. With multiple inheritance, I can deny read on photo for any unregistered user, which is only one operation. Without multiple inheritance, I have to go through every photo and deny unregistered user the read privilege. If I have a lot of photos, this is bad news.
Does anyone know a way to do this? It provides the most flexible solution I can think of. If you can think of something better that can be implemented using Zend_Acl, please reply also!
Thanks very much.