2

I have created a user and given all the required roles to access the module. When we logged in with that particular user , we are able to see the module and module items but when we click on any item in the module we get the following output.

Access denied Please try to sign out and sign in again. If you continue to receive this message, please contact the store owner.

In controller index.php I have this method:

protected function _isAllowed()
{

    return $this->_authorization
                ->isAllowed('NAMESPACE_ModuleName::item');
}

Below is my Acl

<acl>
    <resources>
        <resource id="Magento_Backend::admin">

            <resource id="NAMESPACE_Xyz::xyz" title="NAMESPACE Xyz">
                <resource id="NAMESPACE_ModuleName::main_menu" title="Module Title" 
                                      sortOrder="100">
                    <resource id="NAMESPACE_ModuleName::manage_item" title="Manage Items" 
                              sortOrder="22" />   

            </resource>
            </resource>            
            <resource id="Magento_Backend::stores">
                <resource id="Magento_Backend::stores_settings">
                    <resource id="Magento_Config::config">
                        <resource id="NAMESPACE_ModuleName::configuration" title=" Module Configuration" translate="title" />
                    </resource>
                </resource>
            </resource>
        </resource>
    </resources>
</acl>

The configuration file works for me but, when I click on the menu items , it says access denied.

2

You resource id is id="NAMESPACE_ModuleName::manage_item" so

change

return $this->_authorization
                ->isAllowed('NAMESPACE_ModuleName::item');

to

return $this->_authorization
                ->isAllowed('NAMESPACE_ModuleName::manage_item');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.