0

Some weeks ago I created a new custom menu in backend. Now I want to select this new menu in order to give permissions (or not) to the roles that I have on my website. The problem is that this new custom menu doesn't appears in the resources of the role. You can see this menu only if you have all the access granted.

Anyone knows how to solve this ?

Thanks.

1 Answer 1

3

You need to create in your extension, inside the etc folder a file named adminhtml.xml. In this file you should have the ACL for your menu. Actually you should have the menu in here also but it works even if you added the menu in config.xml
In this file you need to add an xml structura similar to the one you added for the menu.
Here is an example. Let's assume you have a video module and the menu looks like this:

<menu>
    <video translate="title" module="video"><!-- this is the top  level menu -->
        <title>Video</title>
        <sort_order>65</sort_order>
        <children>
            <video translate="title" module="video"><!-- this is the submenu item -->
                <title>Videos</title>
                <action>adminhtml/video</action>
                <sort_order>100</sort_order>
            </video>
        </children>
    </video>
</menu>

For this menu structure you need the following adminhtml.xml file

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <video translate="title" module="video"><!-- this is the top  level menu -->
                        <title>Video</title>
                        <children>
                            <video translate="title" module="video"><!-- this is the submenu item -->
                                <title>Videos</title>
                            </video>
                        </children>
                    </video>
                </children>
            </admin>
        </resources>
    </acl>
</config>

Clear the cache and you should be able to see your menu in the user roles permissions section.

3
  • @Marius Its works... Danke!!!
    – MageDev
    Aug 28, 2014 at 6:36
  • @Marius How can I check permission for action button role permission?
    – Anto S
    Apr 12, 2016 at 4:03
  • @Marius in my config, all working fine. But first time menu item is showing to all users though access not given. If I edit role and save then it disappear. How to make this menu disabled by default?
    – Anto S
    Jul 9, 2017 at 12:25

Your Answer

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

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