/common/config/main.php
Код: Выделить всё
'authManager' => [
'class' => 'yii\rbac\PhpManager',
'defaultRoles' => ['user', 'moder'],
],
/console/rbac/assignments.php
Код: Выделить всё
<?php
return [
2 => [
'user',
],
1 => [
'moder',
],
];
Код: Выделить всё
<?php
return [
'createClient' => [
'type' => 2,
'description' => 'Create a client',
],
'updateClient' => [
'type' => 2,
'description' => 'Update client',
],
'user' => [
'type' => 1,
'children' => [
'createClient',
'updateOwnClient',
],
],
'moder' => [
'type' => 1,
'children' => [
'updateClient',
'user',
],
],
'updateOwnClient' => [
'type' => 2,
'description' => 'Update own client',
'ruleName' => 'isAuthor',
'children' => [
'updateClient',
],
],
];
Код: Выделить всё
<?php
return [
'isAuthor' => 'O:17:"app\\rbac\\UserRule":3:{s:4:"name";s:8:"isAuthor";s:9:"createdAt";N;s:9:"updatedAt";N;}',
];