17452 Posts in 4473 Topics by 1971 members
|Go to End|
4 July 2008 at 12:23pm Last edited: 4 July 2008 12:26pm
Best explained in an example:
Member A is a member of the Group Y
Group Y is the child of X and parent of Z
So folder structure looks like
| - Y
| | - Z
Currently in silverstripe Member A has access to Group Y (of which they are a member) and Group X (of which they inherit) and not group Z.
What I required was the opposite.. so Member A has access to children rather than parent groups. By changing the code below you get Member A having access to Group Y and Group Z, not Group X.
Changed one line the Groups() function from:
I could not see a simpler way of changing this by not editing the core. Hope this helps some people.
5 July 2008 at 11:03am
thanks for the good example - yeah, it seems logical that a group inheritance should be toward more specific (=children) rather than more generic (=parents) - it allows for much more finegrained controls.
although this is a one-line fix, i think we need some unit tests to verify this behaviour (on GroupTest.php), with this hierarchy:
- member1 has access to X, Y1, Z1, Y2
- member2 has access to Y1, Z1
- member3 has access to Z1
- member4 has access to Y2
Unit tests are fairly easy to write (see http://doc.silverstripe.com/doku.php?id=testing-guide) - ScottiouS, do you want to give it a go?
|Go to Top|