4

I have created a custom module, everything is working fine, but when i take the admin user roles it is displaying nothing.

enter image description here

My acl.xml file

<?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_Contact::contacts">
                    <resource id="Suyati_Scontact::contact_manage" title="Manage Conatcts"/>
                </resource>
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Suyati_Scontact::scontact" title="Contacts Section" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

System.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="suyati" translate="label" sortOrder="210">
            <label>Suyati Scontact</label>
        </tab>
        <section id="suyati_scontact" translate="label" type="text" sortOrder="120" showInDefault="1"
                 showInWebsite="1" showInStore="1">
            <label>Contacts</label>
            <tab>suyati</tab>
            <resource>Suyati_Scontact::scontact</resource>
            <group id="email_template" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>Suyati Contact Options</label>
                <field id="pincode" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Is Pincode Required?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>
                <field id="location" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Is Location Required?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>
                <field id="mobile" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Is Mobile Number Required?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>
                <field id="comment" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Is Comment Required?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>                    
                </field>

            </group>
        </section>
    </system>
</config>
4

I just done this and it is working perfectly now

<?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_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Suyati_Scontact::contact_manage" title="Scontacts Section" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>
3

I've tried your code and found an issue. You are trying to extend "Magento_Contact::contacts" resource and insert a child resource into it. But actually such a resource doesn't exist. And Magento tries to create this new resource. But it will throw an error as the resource has no "title" parameter

  • how can i fix this? – Naveenbos Aug 3 '16 at 13:02
  • try adding "title" attribute to the mentioned resource. The line should look like: <resource id="Magento_Contact::contacts" title="Contacts"> – MagestyApps Aug 10 '16 at 8:33
0

It should work fine. Did you upgrade the magento setup after updating the acl.xml. Please run

bin/magento setup:upgrade

via command prompt and check if it works.

  • I have done this several times, not working – Naveenbos Aug 3 '16 at 12:53
  • Did you add id "Magento_Contact::contacts" in etc/adminhtml menu.xml? – Himmat Paliwal Aug 3 '16 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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