taurus-media / module-admin-permissions
Magento 2 module to extend admin user role permissions with Allow/Deny modes.
Package info
github.com/taurus-media/module-admin-permissions
Type:magento2-module
pkg:composer/taurus-media/module-admin-permissions
1.0.2
2026-06-08 10:41 UTC
Requires
- php: ^8.1
- magento/framework: *
- magento/module-authorization: *
- magento/module-user: *
This package is auto-updated.
Last update: 2026-06-08 10:43:10 UTC
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.