If you use different table names in config/web.php , this is not working. I've tried put the new table names in 'components > authManager' and also in 'modules > user-management', not working...
(I've found a solution, see at the end)
config/web.php
...
'components' => [
...
'authManager' => [
'class' => 'yii\rbac\DbManager',
'assignmentTable' => $params['my_auth_assignment'],
'itemTable' => $params['my_auth_item'],
'itemChildTable' => $params['my_auth_item_child'],
'ruleTable' => $params['my_auth_rule'],
],
...
]
...
'modules' => [
'user-management' => [
'class' => 'webvimark\modules\UserManagement\UserManagementModule',
'on beforeAction' => function(yii\base\ActionEvent $event) {
if ($event->action->uniqueId == 'user-management/auth/login') {
$event->action->controller->layout = '@app/views/layouts/main.php'; # loginLayout.php';
};
},
'auth_item_group_table' => $params['my_auth_item_group'],
'user_visit_log_table' => $params['my_user_visit_log'],
'auth_item_table' => $params['my_auth_item'],
'auth_item_child_table' => $params['my_auth_item_child'],
'user_table' => $params['my_user'],
'auth_assignment_table' => $params['my_auth_assignment'],
],
...
SOLUTION: (working for me)
Use
Yii::$app->authManager
instead of
new DbManager()
in
models/rbacDB/Role.php and models/rbacDB/Role.php
models/rbacDB/AbstractItem.php
models/rbacDB/Permission.php
If you use different table names in config/web.php , this is not working. I've tried put the new table names in 'components > authManager' and also in 'modules > user-management', not working...
(I've found a solution, see at the end)
config/web.php
SOLUTION: (working for me)
Use
Yii::$app->authManagerinstead of
new DbManager()in