johnitvn / yii2-rbac-plus

Database role base access control manager for yii2
49 stars 52 forks source link

yii2-rbac-plus

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

Database role base access control manager for yii2

Features

Yii2 RBAC manager

Installation

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.

Usage

  1. Let 's add into modules config in your main config 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:

  1. The module configuration avaible:
'modules' => [
    'rbac' =>  [
        'class' => 'johnitvn\rbacplus\Module',
        'userModelClassName'=>null,
        'userModelIdField'=>'id',
        'userModelLoginField'=>'username',
        'userModelLoginFieldLabel'=>null,
        'userModelExtraDataColumls'=>null,
        'beforeCreateController'=>null,
        'beforeAction'=>null
    ]       
]