The module works as expected if an admin account is logged in. I can see the module in the admin panel and in the Role Resource Tab (System->Permissions->Roles), but when I tried to check the module and save the user role, it will say that it has been saved. But when I rechecked the user role, it is still unchecked.
And when I tried to login using the account with the said user role, the custom module is hidden. What seems to be the problem? Any kind of help is much appreciated..
You can set the structure in ACL for the possibility of the changing the access permissions in the administrative panel (System -> Permissions -> Choose the role -> Role Resources -> Custom). Then you can check whether the user has the access permissions for certain actions using this construction:
You can do the same in the controller using the method _isAllowed (the example is taken from Mage_Adminhtml_Cms_PageController class):
/** * Check the permission to run it * * @return boolean */ protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { case 'new': case 'save': return Mage::getSingleton('admin/session')->isAllowed('cms/page/save'); break; case 'delete': return Mage::getSingleton('admin/session')->isAllowed('cms/page/delete'); break; default: return Mage::getSingleton('admin/session')->isAllowed('cms/page'); break; } }
Please, be attentive because the access permissions (acl) and can be set in the file adminhtml.xml and also new menu elements can be added.