mix8872/yii2-user-admin

RBAC Auth manager for Yii2

Installs: 688

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 1

Type:yii2-extension

v1.0.1 2020-10-21 08:26 UTC

This package is not auto-updated.

Last update: 2024-04-14 22:18:53 UTC


README

This is a fork of mdmsoft/yii2-admin

Installation

Install With Composer

The preferred way to install this extension is through composer.

Either run

php composer.phar require mix8872/yii2-user-admin "dev-master"

Or, you may add

"mix8872/yii2-user-admin": "dev-master"

to the require section of your composer.json file and execute php composer.phar update.

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    'modules' => [
        'user-admin' => [
            'class' => 'mix8872\useradmin\Module',
            ...
        ]
        ...
    ],
    ...
    'as access' => [
        'class' => 'mix8872\useradmin\components\AccessControl',
        'allowActions' => [
            'site/*',
            'admin/*',
            'some-controller/some-action',
            // The actions listed here will be allowed to everyone including guests.
            // So, 'admin/*' should not appear here in the production, of course.
            // But in the earlier stages of your development, you may probably want to
            // add a lot of actions here until you finally completed setting up rbac,
            // otherwise you may not even take a first step.
        ]
    ],
];

See Yii RBAC for more detail.

If you use database (class 'yii\rbac\DbManager') to save rbac data, execute the migration here:

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

If you wand add to user fields: img and display_name, execute the migration here:

yii migrate --migrationPath=@vendor/mix8872/user-admin/src/migrations