romi45/yii2-rbac-collector
Composer 安装命令:
composer require romi45/yii2-rbac-collector
包简介
Using extension you can organize your RBAC configuration in separate files in application modules.
README 文档
README
This extension provides layer between Yii 2 AuthManager and access configuration that can be stored in separate config classes in application modules.
It is useful for large projects where you have truckload of access rules, roles and other stuff.
When you organize your RBAC code in modules - you can easy manage it.
It is only console application component - you don't have to change something in your web application - just use Yii::$app->authManager as you used it before.
Installation
Install this extension through composer.
Either run
$ composer require romi45/yii2-rbac-collector:~1.0
or add
"romi45/yii2-rbac-collector": "~1.0"
to the require section of your composer.json file.
Configuring
Add rbacc module into your modules section in console application config.
'modules' => [ ... 'rbacc' => [ 'class' => 'rbacc\Module', 'collection' => [ // Here is a list of your RBAC config classes. Example you can get in /example directory 'app\modules\user\rbac\Config', 'app\modules\blog\rbac\Config', 'app\modules\hobby\rbac\YouCanNameItAsYouWant', ] ], ... ]
Here is an example of config class. array keys - auth item name value - auth item data
if value is not array - collector recognize it as Permission. if value is array - you have to specify type of Item
namespace rbacc\example; use rbacc\components\ConfigBase; use rbacc\example\rules\UpdateOwnDataRule; use yii\rbac\Item; /** * Class Config * * Example RBAC configuration class * * @package user\rbac */ class Config extends ConfigBase { /** * Gets config data as array * * @return array */ public function getData() { return [ 'user___user__view_profile' => 'View user profile', 'user___user__view_own_profile' => [ 'type' => Item::TYPE_PERMISSION, 'description' => 'View user own profile', 'rule' => new UpdateOwnDataRule(), 'children' => ['user___user__view_profile'] ], 'user' => [ 'type' => Item::TYPE_ROLE, 'description' => 'User', 'children' => ['user___user__view_own_profile'], ], 'admin' => [ 'type' => Item::TYPE_ROLE, 'description' => 'Admin', 'children' => ['user___user__view_profile'] ], 'owner' => [ 'type' => Item::TYPE_ROLE, 'description' => 'Application owner', 'children' => ['admin'], ] ]; } }
For updating RBAC configuration after some changes jus run following command:
$ yii rbacc/update
Collector will read your config classes and update RBAC data using your current AuthManager - PhpManager or DbManager
License
The MIT License (MIT). Please see License File for more information.
romi45/yii2-rbac-collector 适用场景与选型建议
romi45/yii2-rbac-collector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.66k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rbac」 「yii2」 「romi45」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 romi45/yii2-rbac-collector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 romi45/yii2-rbac-collector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 romi45/yii2-rbac-collector 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
Access management from UI
SCEditor, a lightweight WYSIWYG BBCode & HTML editor extension for Yii 2.0 Framework
Seo behavior for Yii2 models and meta tags helper with patterns using possibility
Redirect all not authenticated web user to login page.
Permission handling for lumen 6.x and up
统计信息
- 总下载量: 5.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-07