archey347/uf_altpermissions
Composer 安装命令:
composer require archey347/uf_altpermissions
包简介
Alternate/complementary permission system for UserFrosting V4
README 文档
README
Alternate/complementary permission system for UserFrosting 4
This sprinkle is still a work in progress and not ready yet for production use. No official release has been made yet. Fell free to test it and contribute, or use it as a reference.
Help and Contributing
If you need help using this sprinkle or found any bug, feels free to open an issue or submit a pull request. You can also find me on the UserFrosting Chat most of the time for direct support.
Installation
Edit UserFrosting app/sprinkles/sprinkles.json file and add the following to the require list :
"lcharette/UF_AltPermissions": "dev-master"
Run composer update then composer run-script bake to install the sprinkle.
Usage
Permission Slug Inheritance
If you have a collection of permisisons of actions that are available on a page, you can group these together using dot-delimiter.
For example, if you have a page that allows you to manage a team, you might have the permissions
`team.view, team.edit, team.delete. Then, to test access to the page, you can do hasPermission('team') rather than having to test for each permission.
Alternative to above
The above system would cause problems if you had two permissions within the same namespace but had different seeker types. Instead, it would be better to have a common permission shared by all which you can just test instead.
Seeker Parents/Children
This allows for a permission and a role that have different seekers to be associated with each other.
For example, you may have a scenario where you have multiple organisations, and there are multiple teams inside each organisation. You may need to give some people access to all of the teams in an individual organisation, and then others just access to individual teams. You could do this by having a team.view permission that has a seeker type, team, and then a role called Organisation Manager that has seeker type organisation. Then, you would have to mofify the organisation and team models to tell the access control layer that there is a parent/child relationship.
class Organisation extends Model implements IPermissionParent { protected $table = 'organisations'; protected function getChildren($seekerType) { if($seekerType == 'team') { return $this->teams(); } } protected function teams() { return $this->hasMany('...Models\Team'); } ... } class Team extends Model implements IPermissionChild { $table_name = 'teams'; protected function getChildren($seekerType) { if($seekerType == 'team') { return $this->teams(); } } protected function teams() { return $this->hasMany('...Models\Team'); } ... }
If you have a scenario where you have 3 layers of hierarchy, you have to expllicitly describe the relationship between all three, as the system isn't clever enough (yet!) to figure this out on it's own. The lines represent where child/parent relationships have been declared in the models.
Companies <------
/|\ |
| |
\|/ |
Company Sectors |
/|\ |
| |
\|/ |
Team <------
Licence
By Louis Charette. Copyright (c) 2017, free to use in personal and commercial software as per the MIT license.
archey347/uf_altpermissions 适用场景与选型建议
archey347/uf_altpermissions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「roles」 「permissions」 「userfrosting」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 archey347/uf_altpermissions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 archey347/uf_altpermissions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 archey347/uf_altpermissions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
A secure, modern user management system for PHP.
User permissions for MoonShine
Form generator for UserFrosting V5
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
This package provides a flexible way to add Role-based Permissions to Laravel
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-21