3

I have created a custom module for backend in Magento 1.9.

This module is applicable to all users and roles.

<menu>
    <videos module="videos">
        <title>Video Tutorials</title>
        <sort_order>900</sort_order>               
        <children>
            <bitsvideo module="videos">
                <title>BITS</title>
                <sort_order>5</sort_order>
                <action>videos/adminhtml_videos</action>
            </bitsvideo>
        </children>
    </videos>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <videos module="videos">
                    <sort_order>900</sort_order>               
                    <children>
                      <bitsvideo module="videos">
                          <title>BITS</title>
                          <sort_order>5</sort_order>
                          <action>videos/adminhtml_videos</action>
                       </bitsvideo>
                    </children>
                  </videos>  
            </children>
        </admin>
    </resources>
</acl>

How do I write acl for this?

The above code is my acl. What do I need to change?

How can I write acl to give permissions to all users by default?

1 Answer 1

2

The ACL will be written in app/code/local/{package}/{module}/etc/adminhtml.xml

<?xml version="1.0" ?>
<config>
<menu>
    <videos module="videos" translate="title">
        <title>Video Tutorials</title>
        <sort_order>900</sort_order>               
        <children>
            <bitsvideo module="videos" translate="title">
                <title>BITS</title>
                <sort_order>5</sort_order>
                <action>videos/adminhtml_videos</action>
            </bitsvideo>
        </children>
    </videos>
</menu>
<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <videos module="videos" translate="title">
                    <title>Video Tutorials</title>
                    <sort_order>900</sort_order>               
                    <children>
                        <bitsvideo module="videos" translate="title">
                            <title>BITS</title>
                            <sort_order>5</sort_order> //dont need action tag bellow
                        </bitsvideo>
                    </children>
                </videos>  
            </children>
        </admin>
    </resources>
</acl>
</config>

You can set the acl config in : System > Permissions > Roles

4
  • 1
    I have 70 roles in my magento. I can not give permission by open System > Permissions > Roles to 70 roles,It will not be efficient. Apr 3, 2018 at 6:13
  • Yes, i understand but you have to do it manually
    – PЯINCƎ
    Apr 3, 2018 at 11:08
  • Really.? no other way @Prince.? Apr 3, 2018 at 12:37
  • No, sorry. they will be checked by default only for roles who have all permissions
    – PЯINCƎ
    Apr 3, 2018 at 21:47

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.