Skip to content

fix: Nest Loki_Base::config ACL resource under Magento_Backend::admin - #3

Merged
jissereitsma merged 2 commits into
LokiExtensions:masterfrom
tschallacka:fix/acl-resource-under-config
Oct 2, 2026
Merged

jissereitsma merged 2 commits into
LokiExtensions:masterfrom
tschallacka:fix/acl-resource-under-config

Conversation

@tschallacka

@tschallacka tschallacka commented Sep 28, 2026 •

Copy link
Copy Markdown

TLDR

Loki_Base::config is declared as a top-level ACL resource, next to Magento_Backend::admin instead of inside it. That breaks Magento's integration ACL resolution and hides the permission from restricted admin roles. I moved it one level down, directly under Magento_Backend::admin.

Magento core finds the admin tree by array position, not by id. Magento\Integration\Model\Config\Consolidated\Converter::convert() reads $allResources[1]['children'] and expects the top level to be exactly [Magento_Backend::all (sortOrder 10), Magento_Backend::admin (sortOrder 20)]. With sortOrder="10", Loki_Base::config lands among them and pushes Magento_Backend::admin to index 2. The converter then hashes the wrong subtree, and the ACL resources in any module's integration.xml stop resolving. We hit this in a shop running Loki and had to decorate Magento\Framework\Acl\AclResource\ProviderInterface to move admin back to index 1.

This is not specific to Adobe Commerce/Magento Open Source: Mage-OS has the same lookup on main, release/4.x and 2.4-develop, and the same all/admin top level. It only surfaces in a store where some module ships an integration.xml with ACL resources, which is likely why it has gone unnoticed.

The role editor also only shows the Magento_Backend::admin subtree. A top-level resource never appears as a checkbox, so only "All" roles could open the Loki Base config section.

Raising the sortOrder above 20 would avoid the index problem, but only by luck, and the resource would still be missing from the role tree, so I nested it instead. Sitting inside the admin subtree, it becomes grantable to restricted roles. The resource id is unchanged, so system.xml and existing role rules keep working. etc/acl.xml validates against Magento/Framework/Acl/etc/acl.xsd. I haven't run it in a store with Loki installed yet.

The other Loki modules may declare their resources the same way. I only checked Loki_Base.

Michael Dibbets added 2 commits September 28, 2026 16:56
Loki_Base::config was declared at the top level of the ACL tree, next to
Magento_Backend::all and Magento_Backend::admin. Magento core locates the
admin subtree by position: Magento\Integration\Model\Config\Consolidated\Converter
reads $allResources[1]['children'], assuming the top level is exactly
[Magento_Backend::all (10), Magento_Backend::admin (20)]. With sortOrder 10,
Loki_Base::config lands among them and pushes admin off index 1, so the
converter hashes the wrong subtree and integration.xml resources stop
resolving for every integration in the store.

A top-level resource is also invisible in the role editor, which only shows
the admin subtree, so restricted admin roles could never be granted access
to the Loki Base config section.

The resource now sits under Magento_Config::config, where core declares its
own config-section resources. The id is unchanged, so system.xml and saved
role rules keep working.
Nesting it four levels deep under Magento_Config::config was more than the
fix needs. What matters is that it is no longer a top-level sibling of
Magento_Backend::admin; one level under admin is enough to keep admin at
index 1 and to make the resource grantable in the role editor.
@tschallacka tschallacka changed the title fix: Nest Loki_Base::config ACL resource under Stores > Configuration fix: Nest Loki_Base::config ACL resource under Magento_Backend::admin Sep 28, 2026
@jissereitsma

Copy link
Copy Markdown
Contributor

Thanks for spotting this. Completely makes sense!

@jissereitsma
jissereitsma merged commit 7a57192 into LokiExtensions:master Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants