[dev] Permissions inheritance

Richard Wallace rwallace at thewallacepack.net
Sat Oct 30 13:39:54 PDT 2004


Hey guys,

A simple question for you.  I always thought that child permissions 
inherited settings from their parents.  But I just ran a test to try and 
confirm this and it seems that they don't.

In the app that we're developing we have projects.  Each project has a 
project planner.  It's possible for the project and the project planner 
to have different permissions (a user may want to let someone else fill 
in the planner for them and so would give them permission to do so). 
But to start out with they would have the same permissions and any 
changes to the project should also be made on the planner.  I thought, 
"Ok, I'll create a permission called project:$projectId and another 
called project:$projectId:planner so the planner permission is a child 
of the project permission and should inherit the attributes."

Well, I ran a test to see if this will work.  I gave show and view 
permissions on the project to a user and then added the edit permission 
for that user to the planner permission.  I did a 
$perms->hasPermission() check for the user on the planner for edit 
permission and it came back with a positive.  Then I tried to check for 
read permission for the same user and the same planner and it came back 
negative.

So, are child permissions supposed to inherit parent permissions or am I 
going to have to programatically maintain this relationship?

Thanks,
Rich


More information about the dev mailing list