Answer the question
In order to leave comments, you need to log in
How to attach rbac admin to individual modules in Yii2 using mdmsoft yii2-admin?
Essence of a question:
There is a system on Yii2 (basic template). It has separate modules. There is a system of roles both for the application and for specific modules.
For specific modules, the separation of rights is organized by the configuration of the Module.php file:
public function init()
{
parent::init();
$prefix = $this->id;
$this->components = [
'authManager' => [
'class' => 'app\modules\moduleName\rbac\ModuleDbManager',
'itemTable' => "{{%{$prefix}_auth_item}}",
'itemChildTable' => "{{%{$prefix}_auth_item_child}}",
'assignmentTable' => "{{%{$prefix}_auth_assignment}}",
'ruleTable' => "{{%{$prefix}_auth_rule}}",
],
];
}
$manager = Yii::$app->getAuthManager();
$manager = Yii::$app->getAuthManager();
$prefix = 'moduleName';
$manager->itemTable = "{{%{$prefix}_auth_item}}";
$manager->itemChildTable = "{{%{$prefix}_auth_item_child}}";
$manager->assignmentTable = "{{%{$prefix}_auth_assignment}}";
$manager->ruleTable = "{{%{$prefix}_auth_rule}}";
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