Database role base access control manager for yii2
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist amintado/yii2-module-rbac-plus"*"
or add
"amintado/yii2-module-rbac-plus": "*"
to the require section of your composer.json
file.
'components' => [
'authManager' => [
'class' => 'yii\rbac\DbManager',
],
],
'modules' => [
'rbac' => [
'class' => 'amintado\rbacplus\Module'
]
]
Next, update the database schema
$ php yii migrate/up --migrationPath=@yii/rbac/migrations
Ok. That's done. Avaiable route now:
'modules' => [
'rbac' => [
'class' => 'johnitvn\rbacplus\Module',
'userModelClassName'=>null,
'userModelIdField'=>'id',
'userModelLoginField'=>'username',
'userModelLoginFieldLabel'=>null,
'userModelExtraDataColumls'=>null,
'beforeCreateController'=>null,
'beforeAction'=>null
]
]
Yii::$app->getUser()->identityClass
$userModelClass->attributeLabels()[$userModelLoginField]
'userModelExtraDataColumls'=>[
[
'attributes'=>'created_at',
'value'=>function($model){
return date('m/d/Y', $model->created_at);
}
]
]
'beforeCreateController'=>function($route){
/**
*@var string $route The route consisting of module, controller and action IDs.
*/
}
'beforeAction'=>function($action){
/**
*@var yii\base\Action $action the action to be executed.
*/
}