Answer the question
In order to leave comments, you need to log in
Yii2 authorization. How to set up correctly?
Hey!
The essence of the problem: there are several modules. All actions in any system somehow come down to CRUD. It is necessary to create user groups through the admin panel, certain rights are assigned to user groups: create read update delete and to which modules.
What is the best way to implement this? For Yii 1.1, I had "self-written", no rbac . Now I want to try it.
First I need to set up config/web.php:
'authManager' => [
'class' => 'yii\rbac\DbManager',
'authFile' => '@app/config/rbac.php',
'defaultRoles' => ['guest'],
],
return [
'items' =>[
'admin'=>[
'type'=>1,
'name'=>'admin',
'ruleName' => 'admin',
'description' => 'Админ',
],
'user'=>[
'type'=>2,
'name'=>'user',
'ruleName' => 'user',
'description' => 'Пользователь',
],
'guest'=>[
'type'=>3,
'name'=>'guest',
'ruleName' => 'guest',
'description' => 'Гость',
],
]
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question