P
P
Puganov2015-11-19 14:44:46
Yii
Puganov, 2015-11-19 14:44:46

How can I find out the specific role of an RBAC user?

How can I find out the specific role of the RBAC user if the user has several roles. Preferably one request.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A1eksandr, 2015-11-19
@A1eksandr

roles in yii2 are conditional, access is checked through the availability of actions user->can('manager') - manager conditionally this action with a flag that this action is a role.
With a properly implemented RBAC, for example, such a Yii::$app->user->can('manager') check in the code should work.
You can also filter actions in the controller by roles through accessRules()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question