2

I created a custom module and i placed the list of subscribers under catalog and configuration under system tab and i added acl for this but the tab subscribers under catalog is not accessible but the configuration can access . my acl code is

<adminhtml>
    <menu>
    <catalog>
        <children>
        <outofstocksubscription translate="title" module="outofstocksubscription">
            <title> Subscribers</title>
            <sort_order>190</sort_order>
            <action>outofstocksubscription/adminhtml_subscriber</action>                
        </outofstocksubscription>

     </children>   
    </catalog>
       </menu>  
    <acl>
        <resources>
        <all>
                <title>Allow Everything</title>
            </all>
            <admin translate="title" module="adminhtml">
                 <children>
                  <catalog>
                   <children>
                    <outofstocksubscription translate="title"  module="outofstocksubscription">
                        <title> Subscribers</title>                                         
                    </outofstocksubscription>

             </children>
             </catalog>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <outofstocksubscription translate="title">
                                        <title>Out of Stock Subscription</title>
                                        <sort_order>200</sort_order>
                                    </outofstocksubscription>
                                </children>
                            </config>
                        </children>
                    </system>
                 </children>
            </admin>    
        </resources>    
    </acl>
</adminhtml>    

please help me.

1 Answer 1

5

Assuming you can see the menu item, and thus the ACL is set-up correctly, you need to manually make your controller check the ACL too, by adding the following to your controller:

protected function _isAllowed()
{
    return Mage::getSingleton('admin/session')
        ->isAllowed('catalog/outofstocksubscription');
}

Whilst the menu renderer checks the ACL based on path, by default controllers return false (in previous versions of Magento this defaulted to true). You therefore have to code the check in yourself.

1
  • 1
    This should be te accepted answer. Thank you :)
    – Black
    Nov 12, 2019 at 14:24

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.