Zend\Permissions\Rbac roles should inherit parent permissions, not child permissions #3088

Closed
wants to merge 3 commits into
from

Projects

None yet

4 participants

@dmitrybelyakov

As (logically) stated in documentation "Child role will inherit the permissions of their parent." But current implementation defeats the main purpose on role inheritance, as parent roles will inherit all permissions of their children.

It really should be otherwise :)

Dmitry Belyakov Zend\Permissions\Rbac roles should inherit parent permissions, not ch…
…ild permissions.

As (logically) stated in documentation "Child role will inherit the permissions of their parent." But current implementation defeats the main purpose on role inheritance, as parent roles will inherit all permissions of their children.

It really should be otherwise :)
a9aa0a2
@stefankleff
Contributor

I was wondering about that point too. This is really confusing.

@dmitrybelyakov

Yes, although the presence of the corresponding test "testIsGrantedChildRoles" (the one that fails with Travis) suggests that might be possible developers intent to do it this way. Hope @spiffyjr can clarify this point a bit.

@weierophinney
Member

@spiffyjr -- can you comment on this? It appears that the change causes a test to fail, but it's unclear what the actual intent of the original test was.

@spiffyjr
Contributor

Yes, it should be that children inherit their parents permissions, e.g., guest -> member -> moderator -> administrator. Administrator should have all permissions of moderator, member, and guest, etc.

The code in this PR looks fine but the test will need to be updated.

@dmitrybelyakov

@spiffyjr ok - will update the test then, thanks.

Dmitry Belyakov added some commits Dec 12, 2012
@dmitrybelyakov

@spiffyjr ok did that. Would you please check if its fine now. I actually split the original test in two - one checks if parent roles are not granted child permissions and the other checks that children inherit parent permissions.

@dmitrybelyakov

Still wonder why Travis fails although all tests seem to pass...

@weierophinney weierophinney added a commit to zendframework/zend-permissions-rbac that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/3088' into develop cb7c07e
@weierophinney weierophinney pushed a commit to zendframework/zend-permissions-rbac that referenced this pull request May 15, 2015
@spiffyjr spiffyjr Revert PR zendframework/zendframework#3088 as discussed in zendframew…
…ork/zendframework#3265.

- Reverts a9aa0a2
- Reverts df6eb13
- Reverts 1ec40d0
7434276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment