0

I'm using a module that gives errors for its acl.xml file. The title for the resources is not set.

Can I fix this with a custom module, and overwrite with the correct values? How would I do this? I have never used acl before.

this is the acl in question.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource title="Mageplaza Smtp admin" id="Magento_Backend::admin">
                <resource title="Mageplaza Smtp menu" id="Mageplaza_Core::menu">
                    <resource id="Mageplaza_Smtp::smtp" title="Mageplaza Smtp" translate="title" sortOrder="45">
                        <resource id="Mageplaza_Smtp::log" title="Emails Log" translate="title" sortOrder="10"/>
                        <resource id="Mageplaza_Smtp::abandoned_cart" title="Abandoned Cart" translate="title" sortOrder="20"/>
                    </resource>
                </resource>
                <resource title="Mageplaza Smtp marketing" id="Magento_Backend::marketing">
                    <resource id="Mageplaza_Smtp::email_marketing_menu" title="Email Marketing" sortOrder="20"/>
                </resource>
                <resource title="Mageplaza Smtp stores" id="Magento_Backend::stores">
                    <resource title="Mageplaza Smtp stores_settings" id="Magento_Backend::stores_settings">
                        <resource title="Mageplaza Smtp config" id="Magento_Config::config">
                            <resource id="Mageplaza_Smtp::configuration" title="Mageplaza Smtp"/>
                            <resource id="Mageplaza_Smtp::email_marketing" title="Marketing Automation"/>
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>
2
  • can you show the error and acl.xml file for more information?
    – Msquare
    Aug 9, 2023 at 15:35
  • On which page do you get the error can you share it with us?
    – Msquare
    Aug 10, 2023 at 10:37

2 Answers 2

1

If you get the following exception, my solution will work for you. enter image description here

Lets assume this is the acl.xml with missing title:

<?xml version="1.0"?>
<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">
                <!-- Title is missing in the following line -->
                <resource id="Magento_Catalog::catalog" translate="title" sortOrder="30">
                    <resource id="Magento_Catalog::catalog_inventory" title="Inventory" translate="title" sortOrder="10"/>
                </resource>
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Magento_Catalog::config_catalog" title="Catalog Section" translate="title" />
                        </resource>
                    </resource>
                    <resource id="Magento_Backend::stores_attributes">
                        <resource id="Magento_Catalog::attributes_attributes" title="Product" translate="title" sortOrder="30"/>
                        <resource id="Magento_Catalog::sets" title="Attribute Set" translate="title" sortOrder="40"/>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

Then this acl.xml in your custom module should fix the error:

<?xml version="1.0"?>
<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="Magento_Catalog::catalog" title="Catalog"/>
        </resource>
    </resources>
</acl>
</config>

Note: If you can provide the acl.xml, which throws the error, I can provide the exact solution.

2
  • Hi Ahmad. thank you for your answer. i have added the acl in question. Aug 10, 2023 at 7:47
  • 1
    @JonasdeHerdt the acl.xml has the required titles, however, i noticed you have added the title for Magento_Backend::admin resource as well. Magento_Backend::admin is a resource which is created by Magento and doesnt need to have a title like this - it already has a title from vendor/magento/module-backend/etc/acl.xml
    – Ahmad
    Aug 10, 2023 at 10:43
1
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="<Vendor>_<Module>::top_level" title="Module Title" translate="title" sortOrder="10">
                <resource id="<Vendor>_<Module>::sub_level" title="Sub Level" translate="title" sortOrder="10"/>
            </resource>
        </resources>
    </acl>
</config>
2
  • Welcome to Magento SE. You can use CTRL + K to format a code block. Aug 10, 2023 at 5:28
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Aug 10, 2023 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.