A
A
Alexander Borisovich2014-01-23 15:20:13
Yii
Alexander Borisovich, 2014-01-23 15:20:13

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

3 answer(s)
A
Alexander Borisovich, 2014-01-23
@Alexufo

Phew. Found a way out.
Create a role

use yii\rbac\PhpManager;
$r=new PhpManager;
$r->init();
$r->createRole("admin","Администратор"); 
$r->save();

Assign
$r->assign('1','admin'); //1 is user id

R
Ruslan Kasymov, 2014-01-23
@HDAPache

Maybe you didn't search well? Here's a hint: yiiframework.ru/doc/cookbook/ru/access.rbac.file
Search by the phrase YII + RBAC

A
Alexey Kupreichik, 2014-01-24
@plusodinminus

yii2
docks RBAC docks in yii2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question