定制 taurus-media/module-admin-permissions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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_role table.
  • Dynamic Policy Enforcement: Uses a plugin on Magento\Framework\Authorization\Policy\Acl to intercept permission checks and apply the "Deny" logic when necessary.

Installation

  1. Upload the module files to app/code/Taurus/AdminPermissions.
  2. 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.json as taurus-media/module-admin-permissions.
  • Schema: Adds access_control column to authorization_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\RolePrepareSaveObserver ensures the value is saved during role creation/update.
  • Permission Logic: Taurus\AdminPermissions\Plugin\AclPolicyPlugin handles the inversion of isAllowed checks for roles in "Deny" mode.
  • Source Model: Taurus\AdminPermissions\Model\Config\Source\AccessControl provides constants and options for the access control mode.

Compatibility

  • Magento 2.4+
  • Requires Magento_User and Magento_Authorization modules.

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固