I want make hierarchy RBAC different for some user roles.
Rbac system checked in reverse and recursive for roles and permissions (checkAccess function in DBManager). I don't understand how I can make chain roles/permission for concrete user Role.
I have postController. Roles: admin, author. Permission updatePost.
And two Permissions busyPostRule, authorPostAccessRule.
For example, for admin role I need chain in order (updatePost - busyPostRule - admin) for author (updatePost - authorPostAccessRule - busyPostRule - author). How I safe these order checks for user roles?
Admin only busyPostRule.
Author first authorPostAccessRule, second busyPostRule
In postController AFC:
[
'allow' => true,
'actions' => ['update'],
'roles' => ['updatePost'],
],
If admin role opened update page:
chain (updatePost - busyAdminRole - admin), but if author role:
chain (updatePost - busyAdminRole - admin - BACK - authorAccessRole - busyAuthorRole - author).
How ignore check "busyAdminRole" ?
admin
has to have all privileges with let's saydelete
role and author can haveupdate
role, user just view the post. Soadmin
candelete, update
post butauthor
can justupdate
. Every role is inherited from the lower one. So the admin inherit author access privileges. You can learn more here: yiiframework.com/doc/guide/2.0/en/security-authorization – Serghei Leonenco