riddlestone/brokkr-acl
Composer 安装命令:
composer require riddlestone/brokkr-acl
包简介
A delegating Laminas ACL module
关键字:
README 文档
README
A Laminas module to enable selectively populating Laminas ACL at query time
Sometimes your project has a LOT of roles, resources and rules. This module has plugin managers for those things, and only requests and loads into the ACL the minimum objects needed to answer a query.
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
composer require riddlestone/brokkr-acl
Usage
This module adds four plugin managers, your module/project can provide configuration to any of these.
RoleManager
To provide roles for the ACL, implement Laminas\ServiceManager\FactoryInterface, and then add your class to the
acl_role_manager config:
<?php return [ 'acl_role_manager' => [ 'abstract_factories' => [ 'My\\Factory', ], ], ];
When the ACL requires a role, your factory will be asked if it can provide it.
RoleRelationshipManager
To allow projects and modules to define the relationship between roles, the role relationship manager gathers information about the parents of a given role.
To provide parentage information about roles, implement RoleRelationshipProviderInterface, and register the class as a
provider in the acl_role_relationship_manager config:
<?php return [ 'acl_role_relationship_manager' => [ 'factories' => [ 'My\\Provider' => 'My\\Provider\\Factory', ], 'providers' => [ 'My\\Provider', ], ], ];
Specifying the providers separately from the factories which produce them allow us to use providers which are created through abstract factories, or otherwise injected into the plugin manager.
ResourceManager
To provide resources for the ACL, implement Laminas\ServiceManager\FactoryInterface, and then add your class to the
acl_resource_manager config:
<?php return [ 'acl_resource_manager' => [ 'abstract_factories' => [ 'My\\Factory', ], ], ];
When the ACL requires a resource, your factory will be asked if it can provide it.
RuleManager
To allow projects and modules to specify permissions, the rule manager gathers information about which rules apply to given roles and resources.
To provide rules, implement RuleProviderInterface, and register the class as a provider in the
acl_rule_manager config:
<?php return [ 'acl_rule_manager' => [ 'factories' => [ 'My\\Provider' => 'My\\Provider\\Factory', ], 'providers' => [ 'My\\Provider', ], ], ];
Specifying the providers separately from the factories which produce them allow us to use providers which are created through abstract factories, or otherwise injected into the plugin manager.
Querying the ACL
Once all the managers are configured, you can query the ACL by pulling it from the ServiceManager, and calling
isAllowed():
<?php use Laminas\ServiceManager\ServiceManager; use Riddlestone\Brokkr\Acl\Acl; /** * @var ServiceManager $serviceManager */ $acl = $serviceManager->get(Acl::class); $isAllowed = $acl->isAllowed('some_role', 'a_resource', 'view');
riddlestone/brokkr-acl 适用场景与选型建议
riddlestone/brokkr-acl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 131 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「acl」 「service-manager」 「laminas」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 riddlestone/brokkr-acl 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 riddlestone/brokkr-acl 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 riddlestone/brokkr-acl 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
This package provide a Geo modules for yawik.
Factory-Driven Dependency Injection Container
DotKernel hydrator component extending and customizing laminas-hydrator
DotKernel validator component extending and customizing laminas-validator
DotKernel filter component customizing and extending laminas-filter
统计信息
- 总下载量: 131
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-04-23