fat2fast / yii2-admin
Yii2的RBAC认证管理器
3.2.3
2024-06-22 13:35 UTC
Requires
- deesoft/yii2-adminlte: ~1.0
- deesoft/yii2-angular: ~1.3
- yiisoft/yii2: >=2.0.6
README
警告:此版本不再维护。请使用2.x版本。
composer require fat2fast/yii2-admin "~3.2"
文档
安装
使用Composer安装
通过composer安装此扩展是首选方式。
运行以下命令
php composer.phar require fat2fast/yii2-admin "~3.2"
到你的composer.json
文件的require部分,并执行php composer.phar update
。
从存档安装
从这里releases下载最新版本,然后将其解压到你的项目中。在你的应用程序配置中,添加此扩展的路径别名。
return [ ... 'aliases' => [ '@fat2fast/admin' => 'path/to/your/extracted', // for example: '@mdm/admin' => '@app/extensions/mdm/yii2-admin-3.0.0', ... ] ];
使用方法
扩展安装完成后,只需按以下方式修改你的应用程序配置
return [ 'bootstrap' => [ 'admin', // required ... ], 'modules' => [ 'admin' => [ 'class' => 'fat2fast\admin\Module', ... ] ... ], ... 'components' => [ ... 'authManager' => [ 'class' => 'yii\rbac\PhpManager', // or use 'yii\rbac\DbManager' ] ], 'as access' => [ 'class' => 'fat2fast\admin\classes\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. ] ], ];
有关更多详细信息,请参阅Yii RBAC。然后,你可以通过以下URL访问认证管理器
https:///path/to/index.php/admin
https:///path/to/index.php/admin#/route
https:///path/to/index.php/admin#/permission
https:///path/to/index.php/admin#/menu
https:///path/to/index.php/admin#/role
https:///path/to/index.php/admin#/assignment
要使用菜单管理器(可选),在此处执行迁移
yii migrate --migrationPath=@fat2fast/admin/migrations
如果你使用数据库(类'yii\rbac\DbManager')来保存rbac数据,在此处执行迁移
yii migrate --migrationPath=@yii/rbac/migrations