Magento – Magento 2.1.0 Roles Resource Tree not showing

aclbackendmagento2resourcesuser-roles

in the backend, going to system->roles, adding a new role and setting it to custom permissions, the resource tree is empty.

Stepping through the code I can see, in module_user/Block/Role/Tab/Edit.php in function getTree() it returns three ACL-resources

public function getTree()
    {
        $resources = $this->_aclResourceProvider->getAclResources();
        $rootArray = $this->_integrationData->mapResources(
            isset($resources[1]['children']) ? $resources[1]['children'] : []
        );
        return $rootArray;
    }

The one used for the mapResources-call is Admin_Backend::all with an empty children array. Now in my opinion this leads to the resource tree being empty. Shouldn't there be an extra handling of the this role as it doesn't have explicitly assigned resources to it in the acl.xml? If I change the mapResources to use $resource[2] the tree is shown. But this feels a little awkward as I don't know what side effects that would have.

Any idea what's going wrong?

Best Answer

Open The path /vendor/magento/module-user/Block/Role/Tab/Edit.php

And Change isset($resources[1]['children']) ? $resources[1]['children'] Intoisset($resources[2]['children']) ? $resources[2]['children']

Tree Will Showing

For More Details https://www.oolalaji.com

Related Topic