0

This is a duplicate question of Magento 2.x - Menu not showing for custom role in custom module but I can't seem to figure out how...

I have setup ACL rules for this but it is not showing Menu of custom module for custom user roles.

acl.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/
Framework/Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Thecoachsmb_Blog::main_menu" title="Builder" 
                    sortOrder="100">
                    <resource id="Thecoachsmb_Blog::sample" title="Builder Reviews" 
                        sortOrder="1" />
                </resource>
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Thecoachsmb_Blog::system_config" 
                                title="Thecoachsmb Blog Section" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

menu.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Thecoachsmb_Blog::main_menu"
             title="Builder"
             translate="title"
             module="Thecoachsmb_Blog"
             sortOrder="20" 
             parent="Magento_Reports::report"
             resource="Thecoachsmb_Blog::report_elements" />
        <add id="Thecoachsmb_Blog::post_feedback"
             title="Builder Reviews"
             translate="title"
             module="Thecoachsmb_Blog"
             sortOrder="1"
             parent="Thecoachsmb_Blog::main_menu"
             action="thecoachsmb_blog/post"
             resource="Thecoachsmb_Blog::thecoachsmb_blog" />
    </menu>
</config>

Please provide me the complete controller in using permission. what is the path? Where will I create it. Thanks in advace.

1 Answer 1

1

I solved it like this. No need for the controller part.

acl.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Thecoachsmb_Blog::main_menu" title="Builder" sortOrder="100">
                    <resource id="Thecoachsmb_Blog::post_feedback" title="Builder Reviews" sortOrder="1" />
                </resource>
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Thecoachsmb_Blog::system_config" title="Thecoachsmb Blog Section" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

menu.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Thecoachsmb_Blog::main_menu"
             title="Builder"
             translate="title"
             module="Thecoachsmb_Blog"
             sortOrder="20" 
             parent="Magento_Reports::report"
             resource="Thecoachsmb_Blog::main_menu" />

        <add id="Thecoachsmb_Blog::post_feedback"
             title="Builder Reviews"
             translate="title"
             module="Thecoachsmb_Blog"
             sortOrder="1"
             parent="Thecoachsmb_Blog::main_menu"
             action="thecoachsmb_blog/post"
             resource="Thecoachsmb_Blog::post_feedback" />
    </menu>
</config>

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.