Find us on facebook

Jun 13, 2015

Configuring RBAC Manager Yii2-Advanced Template

Step 1 : edit common/config/main.php And console/config/main.php  as below
'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],


Step 2: use the migration stored in @yii/rbac/migrations:

[yii migrate --migrationPath=@yii/rbac/migrations]

Step 3: Install yii2-admin via composer [composer.phar should be within yii-application folder]

1) php composer.phar require mdmsoft/yii2-admin "~2.0" OR
2) add "mdmsoft/yii2-admin": "~2.0" to the require section of your composer.json file[and run composer.phar update].


 Step 4: edit common/config/main.php as below

'modules' => [
        'admin' => [
            'class' => 'mdm\admin\Module',
        ]
],
'as access' => [
        'class' => 'mdm\admin\components\AccessControl',
        'allowActions' => [
            'admin/*', // add or remove allowed actions to this list
        ]
    ],

Now you can access admin panel for creating/editing Roles/Permissions , Assign users to roles etc...
http://localhost/path/to/index.php?r=admin
http://localhost/path/to/index.php?r=admin/route
http://localhost/path/to/index.php?r=admin/permission
http://localhost/path/to/index.php?r=admin/menu
http://localhost/path/to/index.php?r=admin/role
http://localhost/path/to/index.php?r=admin/assignment

No comments:

Post a Comment