5

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?

  • I added a new role and set it to custom permissions and the tree exists. Is this a default/clean install? Can you show log files? Have you enabled any new extensions? – Mat Hellums Aug 21 '16 at 16:47
  • debug.log main.DEBUG: cache_invalidate: {"method":"POST","url":"...","invalidateInfo":{"tags":["BACKEND_MAINMENU"],"mode":"matchingAnyTag"},"is_exception":false} [] – Jérôme Aug 21 '16 at 18:08
  • Setup is quite clean but uses some extensions: Firegento, Mageplaza-Affiliate, and lots from Plazathemes that came with the theme I use. It´s the first time I use the roles feature, so I can not tell when it stopped working or whether it ever worked. Could it be, that acl.xml from an extension messes it up? Is the described acl-resource array the one expected? @MatHellums – Jérôme Aug 21 '16 at 18:13
  • @MatHellums Does this still work after you added an admin via the console? – Jérôme Aug 31 '16 at 17:17
  • 1
    The problem is induced by the theme I use. After installation of this theme (bought from a 3rd party) the resource tree isnt shown anymore. In case I ever figure out what exactly generated that error I will answer it here! – Jérôme Sep 14 '16 at 14:00
0

I had the same issue with the resources tree rendering blank, and I've found out that the issue was with the acl.xml file of one of the installed modules (it can also be from a theme).

In my case, the module's resources were not inside the Magento_Backend::admin resource tag:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
    <resources>
        <resource id="UOL_PagSeguro::Conciliation" title="Conciliation" sortOrder="10" />
        <resource id="UOL_PagSeguro::Abandoned" title="Abandoned" sortOrder="20" />
        <resource id="UOL_PagSeguro::Cancellation" title="Cancellation" sortOrder="30" />
        <resource id="UOL_PagSeguro::Refund" title="Refund" sortOrder="40" />
        <resource id="UOL_PagSeguro::Credentials" title="Credentials" sortOrder="50" />
    </resources>
</acl>
</config>

After making the changes such as placing the resources inside a group resource tag (one for all the module related resources), and also placing it inside the Magento_Backend::admin tag, fixed the problem.

<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="UOL_PagSeguro::admin" title="PagSeguro">
                <resource id="UOL_PagSeguro::Conciliation" title="Conciliation" sortOrder="10" />
                <resource id="UOL_PagSeguro::Abandoned" title="Abandoned" sortOrder="20" />
                <resource id="UOL_PagSeguro::Cancellation" title="Cancellation" sortOrder="30" />
                <resource id="UOL_PagSeguro::Refund" title="Refund" sortOrder="40" />
                <resource id="UOL_PagSeguro::Credentials" title="Credentials" sortOrder="50" />
            </resource>
        </resource>
    </resources>
</acl>
</config>

Finally, to find out the module/theme thats causing this issue, check their acl.xml files or try to disable one by one and check the roles & permissions page to see if the tree is visible again.

Remember to clear cache if you're not running in developer mode!

  • @Jérôme Did this answer clarify the causes of your issue? – Pedro Guedes Apr 11 '17 at 15:01
0

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

0

Had the same issue and the reason appeared to be some malware which came with google chrome extension. I would recommend to take a look inside the developer console of your browser.

You may also see the html source of the page and find the div element that will look like this:

<div class="tree x-tree" data-role="resource-tree" data-mage-init="{...}"

Under data-mage-init attribute there should be the json structure of the tree. If you do not see the huge json string inside data-mage-init attribute, search for the problem on the server side.

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.