macfly/yii2-rbac-cli
最新稳定版本:0.1.8
Composer 安装命令:
composer require macfly/yii2-rbac-cli
包简介
Yii2 module, provide a cli to load initial permission and roles in rbac from a yaml file
README 文档
README
Create role and permission from the command line based on the content of a YAML or JSON file.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist "macfly/yii2-rbac-cli" "*"
or add
"macfly/yii2-rbac-cli": "*"
to the require section of your composer.json file.
Configure
Configure config/console.php as follows
'modules' => [ ................ 'rbac' => [ 'class' => 'macfly\rbac\Module', ], ................ ],
Usage
Import static role and permission list
Create a yaml file with le list of static role and permission you want to create
# Permission section permissions: list: desc: List user create: desc: Create user update: desc: Edit user profile: desc: Edit user profile delete: desc: Remove user # Role section roles: view: desc: View users children: - list - info admin: desc: Administration children: - view # Assign permission and roles to a specific userid assign: 1: - admin - oauth.admin 2: - user.info
After run the @rbac/yaml@ with the path to your yaml file
php yii rbac/load/yaml /tmp/role.yml
Add role or permission to a specific user
You can add some role and permission from the cli to a specific user id.
php yii rbac/load/add userid permissionOrRoleName
For example to add role 'view' to user with id '1' :
php yii rbac/load/add 1 view
统计信息
- 总下载量: 25.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-03-10