taurus-media/module-admin-permissions
Composer 安装命令:
composer require taurus-media/module-admin-permissions
包简介
Magento 2 module to extend admin user role permissions with Allow/Deny modes.
README 文档
README
Overview
This module extends the default Magento 2 admin user role logic by adding an "Access Control" mode. It allows administrators to choose between "Allow" (default whitelist behavior) and "Deny" (blacklist behavior) for each role.
Features
- Access Control Mode: A new fieldset on the Role Resources tab (right above the Roles Resources fieldset) with two options:
- Allow: Default Magento behavior. Selected resources are whitelisted.
- Deny: Selected resources are restricted (blacklisted). Any resource NOT selected will be allowed.
- Persistent Storage: Saves the access control mode in the
authorization_roletable. - Dynamic Policy Enforcement: Uses a plugin on
Magento\Framework\Authorization\Policy\Aclto intercept permission checks and apply the "Deny" logic when necessary.
Installation
- Upload the module files to
app/code/Taurus/AdminPermissions. - Run the following commands from the Magento root:
php bin/magento setup:upgrade php bin/magento cache:clean
Technical Implementation Details
- Composer: Defined in
composer.jsonastaurus-media/module-admin-permissions. - Schema: Adds
access_controlcolumn toauthorization_role(0 = Allow, 1 = Deny). - UI Extension: Adds a separate fieldset with the "Access Control" field to the Role Resources tab by injecting a child block into
adminhtml.user.tab.rolesedit. This avoids overwriting the default Magento template. - Data Persistence:
Taurus\AdminPermissions\Observer\RolePrepareSaveObserverensures the value is saved during role creation/update. - Permission Logic:
Taurus\AdminPermissions\Plugin\AclPolicyPluginhandles the inversion ofisAllowedchecks for roles in "Deny" mode. - Source Model:
Taurus\AdminPermissions\Model\Config\Source\AccessControlprovides constants and options for the access control mode.
Compatibility
- Magento 2.4+
- Requires
Magento_UserandMagento_Authorizationmodules.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-08