Magento – Custom module role permission. How to add acl

aclmagento-1.9modulepermissionsxml

I need to be able to control my custom module's role permission and I can see I have to add acl in my XML.

I have tried to add it in config.xml and also made an adminhtml.xml in the same location.

Can you take a look and see where I have to add it?

UPDATE: I've tried the steps mentioned below, but no luck. I can't get it to work. Can someone help to solve the problem?

config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <Puk_EmailOrder>
      <version>0.1.1</version>
    </Puk_EmailOrder>
  </modules>
    <frontend>
        <routers>
            <routeurfrontend>
                <use>standard</use>
                <args>
                    <module>Puk_EmailOrder</module>
                    <frontName>emailorder</frontName>
                </args>
            </routeurfrontend> 
        </routers>
        <layout>
            <updates>
                <emailorder>
                    <file>emailorder.xml</file>
                </emailorder>
            </updates>
        </layout>
    </frontend>
  <global>
    <helpers>
      <emailorder>
        <class>Puk_EmailOrder_Helper</class>
      </emailorder>
    </helpers>
    <blocks>
      <emailorder>
        <class>Puk_EmailOrder_Block</class>
      </emailorder>
    </blocks>
    <models>
        <emailorder>
            <class>Puk_EmailOrder_Model</class>
            <resourceModel>emailorder_mysql4</resourceModel>
        </emailorder>
        <emailorder_mysql4>
            <class>Puk_EmailOrder_Model_Mysql4</class>
            <entities>
                <emailorder>
                    <table>emailorder</table>
                </emailorder>
            </entities>
        </emailorder_mysql4>
      </models> 
    <resources>
      <emailorder_setup>
        <setup>
          <module>Puk_EmailOrder</module>
        </setup>
        <connection>
          <use>core_setup</use>
        </connection>
      </emailorder_setup>
      <emailorder_write>
        <connection>
          <use>core_write</use>
        </connection>
      </emailorder_write>
      <emailorder_read>
        <connection>
          <use>core_read</use>
        </connection>
      </emailorder_read>
    </resources>
  </global>
  <admin>
    <routers>
      <adminhtml>
        <args>
            <modules>
              <emailorder before="Mage_Adminhtml">Puk_EmailOrder_Adminhtml</emailorder>
            </modules>
        </args>
      </adminhtml>
    </routers>
  </admin>
  <adminhtml>
    <menu>
        <sales>
          <children>
              <order_items translate="title" >
                 <title>Email Order</title>
                 <sort_order>20</sort_order>
                 <action>adminhtml/order_items/index</action>
              </order_items>
          </children>         
        </sales>
      </menu>
  </adminhtml>
</config> 

adminhtml.xml:

<?xml version="1.0" encoding="UTF-8" ?>
    <config>
        <acl>
          <resources>
            <all>
              <title>Allow Everything</title>
            </all>
            <admin>
             <children>
                <customer translate="title" module="emailOrder">
                  <children>
                    <set_time translate="title">
                    <title>Email order</title>
                    </set_time>
                  </children>
                </customer>
              </children>
            </admin>
          </resources>
        </acl>
    <config>

Best Answer

Your "acl" tree does not match the "menu" tree.

You have to copy everything below menu to acl/resources/admin/children and remove the <action> nodes.

Example:

http://i.stack.imgur.com/9CiIQ.png

In your case, that means, adminhtml.xml should look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <acl>
      <resources>
        <admin>
         <children>

           <sales>
             <children>
               <order_items translate="title" >
                 <title>Email Order</title>
                 <sort_order>20</sort_order>
               </order_items>
             </children>         
           </sales>

          </children>
        </admin>
      </resources>
    </acl>
</config>