marcogeorge7/permission-generator
Composer 安装命令:
composer require marcogeorge7/permission-generator
包简介
Generate json file with all permission that call in controllers and views
README 文档
README
permission-generator scans your project resources/view/ and app/ folder to find @can(...), Gate::allow(...)
functions, then it create keys based on first parameter value and insert into json permission file.
Installation
You just have to require the package
$ composer require marcogeorge7/permission-generator
This package register the provider automatically, See laravel package discover.
Usage
First you have to create json files in resource to save permission in it:
app/
resources/
role/
permissions.json
second, publish the configuration file.
php artisan vendor:publish --provider="PermissionGenerator\Framework\GeneratorServiceProvider"
Output
generator:update command will scan your code to identify new permission keys, then it'll update json file on app/resources/role/ folder appending this keys.
{
"access_index": "can access all",
"create_user": "can create user",
"update_user": ""
}
if for any reason artisan can't find generator:update command, you can register the provider manually on your config/app.php file:
return [ ... 'providers' => [ ... PermissionGenerator\Framework\GeneratorServiceProvider::class, ... ] ]
Customization
You can change the default path of views to scan and the output of the json permission file.
Todo
- auto create value as a description of permission in json object
- insert permission in database table permission as defult and can replace it with config file
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-01