Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Does ACL Role Inheritance Nest Automatically?

I'm basically wondering if a role inherits all the inheritance that the role it inherits from already inherits (I know, a mouthful).

IE: Do I have to explicitly cite all sub-inheritance:

//Restricted User can do everything a Guest can do:
$acl->addInherit('Restricted User','Guest');
// User can do everything a Restricted User can do:
$acl->addInherit('User','Guest');
$acl->addInherit('User','Restricted User');
// Admin can do everything a User and Restricted User and a Guest can do:
$acl->addInherit('Admin','Guest');
$acl->addInherit('Admin','Restricted User');
$acl->addInherit('Admin','User');

Or does it automatically grab nested permissions, like so:

//Restricted User can do everything a Guest can do:
$acl->addInherit('Restricted User','Guest');
// User can do everything a Restricted User can do
$acl->addInherit('User','Restricted User');
// Admin can do everything a User can do
$acl->addInherit('Admin','User');


3.2k
Accepted
answer

Found it in the source:

        /**
         * Deep inherits
         */
        if isset this->_roleInherits[roleInheritName] {
            for deepInheritName in this->_roleInherits[roleInheritName] {
                this->addInherit(roleName, deepInheritName);
            }
        }

Apparently the "deep inheritance" is automatic, so the 2nd set of code should work fine.