Answer the question
In order to leave comments, you need to log in
Yii2 RBAC how to exclude some rights of a child role?
Greetings!
There are two roles, user and guest.
The guest has access to the login page, let's call this item "login".
Guest is a child role of User, i.e. everything that a guest can do, a user can do.
Now the question is - how to exclude access from the user to the authorization page?
Interested in true-way.
I see options - checking the role in bizrule / checking the role in the action itself. Am I missing something or are there other options?
Answer the question
In order to leave comments, you need to log in
why do you need a role in this case?
check against Yii::$app->user->isGuest Returns whether the user is logged in.
No way, if you started making a white list, then continue it, i.e. in your case it is necessary to exclude inheritance. Otherwise, the mixture of black list and white list will be very scary both in implementation and in understanding.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question