We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

multiple accessInherits at acl

hi. my acl is like :

$guestRoles = new Role('guest');

$userRoles = new Role('user');

$secretary = new Role('secretary');

$consultant = new Role('consultant');

$managerRoles = new Role('manager');

$adminRoles = new Role('admin');

i want to have the "secretary","consultant","manager" above the user role and admin role above this three role .

$acl->addRole($guestRoles);

$acl->addRole($userRoles, $guestRoles);

acl->addRole($managerRoles, $userRoles);

$acl->addRole($secretary, $userRoles);

$acl->addRole($consultant, $userRoles);

$acl->addRole($adminRoles, $consultant);

$acl->addRole($adminRoles, $secretary);

$acl->addRole($adminRoles, $managerRoles);

is this the correct way to implement ? i want adminRole to inherit 3 role that are the same level .



145.0k
Accepted
answer

AddRole is for adding role one time. So you can add admin role only once using addRole, if you want to inherit rules from secretary and manager then you need to use addInherit method instead of addRole.



1.2k

@Wojciech Thanks . i didnt know about addInherit method .