zelenin/yii2-rbac-module

This package is abandoned and no longer maintained. No replacement package was suggested.

Yii2 RBAC module with generating assignments to DB from RBAC data store file rbac.php

Installs: 1 569

Dependents: 0

Suggesters: 0

Security: 0

Stars: 23

Watchers: 9

Forks: 10

Open Issues: 0

Type:yii2-extension

0.3.0 2015-03-02 00:00 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:35:47 UTC


README

Yii2 RBAC module with generating assignments to DB from RBAC data storage files. Also "classic" PhpManager is available.

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require zelenin/yii2-rbac-module "dev-master"

or add

"zelenin/yii2-rbac-module": "dev-master"

to the require section of your composer.json

Usage

DbManager

Configure AuthManager component in config:

'components' => [
    'authManager' => [
        'class' => \Zelenin\yii\modules\Rbac\components\DbManager::className(),
        'itemFile' => '@common/config/rbac/items.php',
        'assignmentFile' => '@common/config/rbac/assignments.php',
        'ruleFile' => '@common/config/rbac/rules.php',
        'defaultRole' => 'user',
		'roleParam' => 'role' // User model attribute
	]
]

Run:

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

or use sql file in @yii/rbac/migrations/

For generating assignments from php storage files run

php yii rbac/generate

For storage files examples see example directory

PhpManager

Configure AuthManager component in config:

'components' => [
    'authManager' => [
        'class' => \Zelenin\yii\modules\Rbac\components\PhpManager::className(),
        'itemFile' => '@common/config/rbac/items.php',
        'assignmentFile' => '@common/config/rbac/assignments.php',
        'ruleFile' => '@common/config/rbac/rules.php',
        'defaultRole' => 'user',
		'roleParam' => 'role', // User model attribute
	]
]

Info

See Yii2 authorization guide

Author

Aleksandr Zelenin, e-mail: aleksandr@zelenin.me