Using two modules: Vendor_ModuleA
and Vendor_ModuleB
, where Vendor_ModuleA
will be a backend main menu/ACL module.
Other modules (in this example Vendor_ModuleB
) should use the ACL menu of Vendor_ModuleA
and append a child tree entry into the navigation.
The idea is that once this works, I can use resources for Vendor_ModuleC
etc as well.
- ACL for
ModuleA
:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Vendor_ModuleA::mainacl" title="Vendor Main ACL" sortOrder="1">
<resource id="Vendor_ModuleA::mainmenu" title="Vendor Module A Main Menu" sortOrder="1" />
<resource id="Vendor_ModuleA::systemconfigsettings" title="Vendor Module A Config Settings Access" />
</resource>
</resource>
</resources>
</acl>
</config>
- ACL for
Vendor_ModuleB
which I am attempting to use the resource parent tree (Vendor_ModuleA
) and add a sub node inside.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Vendor_ModuleA::mainmenu">
<resource id="Vendor_ModuleB::top_level" title="Module B Main Menu" sortOrder="1" />
</resource>
<resource id="Vendor_ModuleA::systemconfigsettings">
<resource id="Vendor_ModuleB::systemconfigsettings" title="Module B Config Settings" />
</resource>
</resources>
</acl>
</config>
Error
This implementation results in the following error:
Could not create an acl object: Resource id 'Vendor_ModuleA::systemconfigsettings'
already exists in the ACL
Issue
Most resources append a sub-node into resource Magento_Backend::admin
as shown in ModuleA, but when I try to do the same (append) using the node Vendor_ModuleA::systemconfigsettings
it now seems to think I am updating it, which is not the intention.
Question
How do I correctly configure ACL node to append as a child in seperate module/s?