Answer the question
In order to leave comments, you need to log in
How to make different permissions for action in one controller?
Hello! I understand Yii2, and got to the separation of rights. Found and dealt with RBAC. Handy thing, very. But all the examples that I found - they show how to allow access to some action in the controller for a user group. For example here:
'actions' => ['index','delete','update'],
'allow' => true,
'roles' => ['root'],
Answer the question
In order to leave comments, you need to log in
rules is an array with rules. add as many as you like. For example:
//...
'rules' => [
[
'allow' => true,
'actions' => ['action1',],
'roles' => ['root', ],
],
[
'allow' => true,
'actions' => ['action2', 'actionN', ],
'roles' => ['admin', '?', '@'],
],
//...
],
//...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question