ripaclub/aclman
Composer 安装命令:
composer require ripaclub/aclman
包简介
A library designed to manage ACL
README 文档
README
AclMan is a PHP library designed to manage access control list (ACL).
Requisites
-
PHP >= 5.4
-
Composer
Features
AclMan has various features:
-
Assertions
It provides an
AssertionPluginManagerwhose goal is to deliver the assertions (i.e.,AssertionInterfaceobjects) -
Permissions
Contains a class,
GenericPermission, that is a container of permission options (e.g., a role, a resource, a privilege, an assertion) -
Resources and roles
It provides a set of traits aimed to check the validity of resources and roles and instantiate their relative classes
-
Storages
AclMan allows you to save the ACL configuration in several layers persistence, via
StorageInterfaceobjects and adapters (e.g.,ArrayAdapter) -
Services
A set of classes aimed at the instantiation of ACL objects
Installation
Add ripaclub/aclman to your composer.json.
{
"require": {
"ripaclub/aclman": "~0.2.0"
}
}
Configuration
AclMan library has only two configuration nodes:
-
aclman_storageto configure the persistence layer in which to save your ACL rules -
aclman_servicesto configure your services (e.g., a storage and optionally a plugin manager)
Usage (1)
So, here is an example of use. You first need to configure the factories.
Put this PHP array into your configuration file.
'abstract_factories' => [ 'AclMan\Service\ServiceFactory', 'AclMan\Storage\StorageFactory' ], 'factories' => [ 'AclMan\Assertion\AssertionManager' => 'AclMan\Assertion\AssertionManagerFactory' ]
Then we configure our service.
'aclman_services' => [ 'AclService\Ex1' => [ 'storage' => 'AclStorage\Ex1', 'plugin_manager' => 'AclMan\Assertion\AssertionManager', ], ] 'aclman-assertion-manager' => [ 'invokables' => [ 'assertAlias' => 'assertionClass', ... ... ] ]
Finally, our storage configuration.
'aclman_storage' => [ 'AclStorage\Ex1' => [ 'roles' => [ // Config specific permission for role Role1 to resources Resource1 and Resource2 'Role1' => [ 'resources' => [ 'Resource1' => [ [ 'assert' => null, 'allow' => true, 'privilege' => 'add' ] ], 'Resource2' => [ [ 'assert' => [ 'assertAlias' => [ 'config' => 'test' ], ], 'allow' => true, 'privilege' => 'view' ] ] ], ], // Config specific permission for all roles to resource Resource1 (e.x public resource) StorageInterface::ALL_ROLES => [ 'resources' => [ 'Resource3' => [ [ 'allow' => true, ] ], ] ], // Config specific permission for Admin to all resource (e.x access to al resource to the admin) 'Admin' => [ 'resources' => [ StorageInterface::ALL_RESOURCES => [ [ 'allow' => true, ] ], ] ], ], ], ]
Our first ACL configuration is now complete. Use it:
$aclService1 = $serviceLocator->get('AclService\Ex1'); $aclService1->isAllowed('Role1', 'Resource1', 'view'); // FALSE $aclService1->isAllowed('Role1', 'Resource1', 'add'); // TRUE // ...
Notice the behaviour ...
$aclService1 = $serviceLocator->get('AclService\Ex1'); $aclService1->isAllowed('Role1', 'Resource1', 'add'); // TRUE $aclService1->isAllowed('Role1', 'Resource2', 'view'); // FALSE // ...
ripaclub/aclman 适用场景与选型建议
ripaclub/aclman 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 224 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「storage」 「acl」 「resources」 「roles」 「access control list」 「acl manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ripaclub/aclman 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ripaclub/aclman 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ripaclub/aclman 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
Resource group sub-menus for Laravel Nova.
Laravel Multiauth package
Payment resources library used by the official CCV Payment Services plugins
Filament package to prevent the update of outdated records.
统计信息
- 总下载量: 224
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 19
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2014-10-28