Friday 30 May 2014

Set user permission & role in Custom module in magento

For set user permission & role in your custom module, you have to change your custom module's ect/config.xml file
 remove these type of code
        <acl>
          <resources>
            <all>
              <title>Allow Everything</title>
            </all>
            <admin>
              <children>
                <Namespace_Contactsdetail>
                  <title>Contactsdetail Module</title>
                  <sort_order>10</sort_order>
                </Namespace_Contactsdetail>
              </children>
            </admin>
          </resources>
        </acl>
Add below Code instead of it.

        <acl>
          <resources>
            <all>
              <title>Allow Everything</title>
            </all>
            <admin>
              <children>
                <system>
                  <children>
                    <config>
                      <children>
                        <contactsdetail translate="title" module="contactsdetail">
                          <title>Contactsdetail</title>
                        </contactsdetail>
                      </children>
                    </config>
                  </children>
                </system>
                <contactsdetail>
                  <title>contactsdetail Module</title>
                  <sort_order>10</sort_order>
                  <children>
                    <items>
                      <title>Contactsdetail</title>
                      <sort_order>3</sort_order>
                    </items>
                  </children>
                </contactsdetail>
              </children>
            </admin>
          </resources>
        </acl>