Skip to content

Menu not showing for custom role in custom module

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.