abwebdevelopers/oc-user-permissions-plugin
Composer 安装命令:
composer require abwebdevelopers/oc-user-permissions-plugin
包简介
User Permissions for October CMS
README 文档
README
Front-end user permissions management.
Requirements
This plugin requires the RainLab.User Plugin.
Available Configurations
{plugin}/config/config.php
[
/*
* This lets you configure your own alias to use instead of the default
* "hasUserPermission" method name.
*/
'hasUserPermissionAlias' => 'hasUserPermissionAlias'
]
Creating Permissions
In the backend, navigate to RainLab "Users" menu, on the left side there should
be a open lock icon with the name "Permissions". Click this and it will take you
to the list of permission.
- Click "New Permission" to get to a form where you can enter information about a new
permission you would like to create (dont forget to save). - Click on a permission in the list to manage existing permissions.
Managing User Permissions
In the backend, navigate to RainLab "Users" menu, either create a new user by
clicking "New User" and navigate to the "Permissions" tab of the newly opened form.
Here you can choose between "ALLOW", "INHERIT" or "DENY" for all existing permissions.
- "ALLOW" will grant the user the permission, this takes precedence over group permissions.
- "INHERIT" will grant the user the permission only if they also belong to a group which
also has the permission set to allow (if they are checked). - "DENY" will NOT grant the user the permission, this takes precedence over group
permissions meaning that even if the user belongs to a group with the permission
allowed the user will not have the permission.
The same tab is available for all existing users, simply click the user you want
to manage in the user list and navigate to the "Permissions" tab.
Managing Group Permissions
In the backend, navigate to RainLab "Users" menu, either create a new group by
clicking "User Groups" and then on "New Group" or click the group you want to edit.
Navigate to the "Permissions" tab and click (check) all the permissions you want this group to have.
Using UserPermissions in your own development
Available UserPermissions functions:
/**
* Check if user has supplied permissions
*
* @param mixed $permission Single string, single integer or Array structure with strings and/or integers
* @param string $match How to match the permission(s), "all" or "one", defaults to "all"
*
* @return boolean Returns if user has supplied permission(s)
*/
function hasUserPermission($permission, $match = 'all') {
<...>
}
Since every user model is extended with the same function it is available in both twig and backend php i.e.
For Twig
{% if user.hasUserPermission([1, 2, "can-eat-cake"]) %}
<p>This user has all above permissions</p>
{% else %}
<p>This user does not have permission</p>
{% endif %}
{% if user.hasUserPermission([1, 2, "can-eat-cake"], 'one') %}
<p>This user has one of the above permissions</p>
{% else %}
<p>This user does not have permission</p>
{% endif %}
For Backend
if($user->hasUserPermission([1, 2, "can-eat-cake"])) {
// This user has all above permissions
} else {
// This user does not have permission
}
if($user->hasUserPermission([1, 2, "can-eat-cake"], 'one')) {
// This user has one of the above permissions
} else {
// This user does not have permission
}
abwebdevelopers/oc-user-permissions-plugin 适用场景与选型建议
abwebdevelopers/oc-user-permissions-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「cms」 「user」 「permissions」 「october」 「rainlab」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 abwebdevelopers/oc-user-permissions-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 abwebdevelopers/oc-user-permissions-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 abwebdevelopers/oc-user-permissions-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Integrate with Snipcart.
Standalone replacement for php's native get_browser() function
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-08