Answer the question
In order to leave comments, you need to log in
Yii 2. How to assign roles?
That is very little information. Do not tell me where to dig?
Create role, created. But how to name this role to the user?
Answer the question
In order to leave comments, you need to log in
Phew. Found a way out.
Create a role
use yii\rbac\PhpManager;
$r=new PhpManager;
$r->init();
$r->createRole("admin","Администратор");
$r->save();
$r->assign('1','admin'); //1 is user id
Maybe you didn't search well? Here's a hint: yiiframework.ru/doc/cookbook/ru/access.rbac.file
Search by the phrase YII + RBAC
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question