1

I have created a custom admin module and added a menu tab, After that I set ACL role & permission but it's not showing the menu item. See below screen

enter image description here

But When I log in with specified user. It's not showing.

enter image description here

My config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Bluehorse_Warehouse>
            <version>1.9.2</version>
        </Bluehorse_Warehouse>
    </modules>
    <frontend>
        <routers>
            <warehouse>
                <use>standard</use>
                <args>
                    <module>Bluehorse_Warehouse</module>
                    <frontName>warehouse</frontName>
                </args>
            </warehouse>
        </routers>
        <layout>
            <updates>
                <warehouse>
                    <file>warehouse.xml</file>
                </warehouse>
            </updates>
        </layout>
    </frontend>
    <global>
        <helpers>
            <warehouse>
                <class>Bluehorse_Warehouse_Helper</class>
            </warehouse>
        </helpers>
        <blocks>
            <warehouse>
                <class>Bluehorse_Warehouse_Block</class>
            </warehouse>
        </blocks>
        <models>
            <warehouse>
                <class>Bluehorse_Warehouse_Model</class>
                <resourceModel>warehouse_mysql4</resourceModel>
            </warehouse>
            <warehouse_mysql4>
                <class>Bluehorse_Warehouse_Model_Mysql4</class>
                <entities>
                    <warehouse>
                        <table>bh_warehouse</table>
                    </warehouse>
                    <zipcode>
                        <table>bh_zipcode</table>
                    </zipcode>
                    <product>
                        <table>bh_product</table>
                    </product>
                </entities>
            </warehouse_mysql4>
        </models>
        <resources>
            <warehouse_setup>
                <setup>
                    <module>Bluehorse_Warehouse</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </warehouse_setup>
            <warehouse_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </warehouse_write>
            <warehouse_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </warehouse_read>
        </resources>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Bluehorse_Warehouse before="Mage_Adminhtml">Bluehorse_Warehouse_Adminhtml</Bluehorse_Warehouse>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <warehouse>
                    <file>warehouse.xml</file>
                </warehouse>
            </updates>
        </layout>
    </adminhtml>
</config> 

And my adminhtml.xml

<?xml version="1.0"?>
<config>
    <menu>
        <warehouses translate="title" module="warehouse">
            <title>Warehouse</title>
            <sort_order>80</sort_order>
            <children>
                <!-- child items go here -->
                <index translate="title" module="warehouse">
                    <title>Warehouse Manage</title>
                    <sort_order>10</sort_order>
                    <action>adminhtml/warehouse/</action>
                </index>
            </children>
        </warehouses>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <warehouse translate="title" module="warehouse">
                                        <title>Warehouse</title>
                                        <sort_order>10</sort_order>
                                    </warehouse>
                                </children>
                            </config>
                        </children>
                    </system>   
                    <warehouse translate="title" module="index">
                        <title>Warehouse list</title>
                        <sort_order>-100</sort_order>
                        <children>
                            <index translate="title">
                                <title>Index Action</title>
                                <sort_order>1</sort_order>
                            </index>
                        </children>
                    </warehouse>    
                </children>
            </admin>
        </resources>
    </acl>
</config>

And I had added in my Controller

protected function _isAllowed() {
    $adminSession = Mage::getSingleton('admin/session');
    return $adminSession->isAllowed('warehouse/index');
}

its not showing the tab in menu.

I also tying many blogs but not solved my problem

Please help me.

1
  • i will check and let u know
    – Amit Bera
    Commented Mar 28, 2016 at 20:44

1 Answer 1

1

Try to add to the your controller:

protected function _isAllowed() 
{
    return true; // just for test
}

Log out/Log in. Then try to check again.

If it helps, modify your _isAllowed method:

protected function _isAllowed() 
{
    $aclResource = 'yours/module/acl/path';
    return Mage::getSingleton('admin/session')->isAllowed($aclResource);
}
7
  • Giving the same error. Commented Mar 27, 2016 at 19:58
  • Try to debug Mage_Admin_Model_Session::isAllowed Commented Mar 27, 2016 at 19:59
  • How can I do it? Commented Mar 27, 2016 at 20:15
  • At first check (in Mage_Admin_Model_Session::isAllowed) that the path of a resource similar with path in acl rules of your module Commented Mar 27, 2016 at 20:35
  • When I checking with logged by administrator role its return true, but checking with one another user its not showing. Gives the same error. Commented Mar 28, 2016 at 5:06

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.