1

I have tried to use ACL on custom admin controller but it is not working.

My etc/acl.xml file is this:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Vendor_Module::index_index" sortOrder="10" title="Tool Title"/>
            </resource>
        </resources>
    </acl>
</config>

Controller location:

Vendor/Module/Controller/Adminhtml/Index/Index.php

I have also added this function in my controller

protected function _isAllowed()
{
    return $this->_authorization->isAllowed('Vendor_Module::index_index');
}

After this, option appearing in admin role, but after assigning to role, tool is not appearing on that specific role user.

Any help would be highly appreciated.

4

1 Answer 1

0

You may be missing an entry in the authorization_rule table. Find your group role ID in the authorization_role table and check to see if it has a paired entry with your resource ID (in your case, Venodr_Module::index_index) in the authorization_rule table. If not, try saving the group role again or manually add entry into the table.

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.