Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Role Resources not showing [SOLVED]
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

Hello,

my problem is that in the Adminhtml Interface, under System > Permissions > Roles, the Resources Tree
isn’t showing (see the attached screenshot).

I traced the problem back to app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php, Line 62

$resources Mage::getModel('admin/roles')->getResourcesTree();

On installations where the resource tree is showing, the returned tree looks like this:

Mage_Core_Model_Config_Element Object
(
    
[all] => Mage_Core_Model_Config_Element Object
        
(
                
[...snip...]
        
)

    
[admin] => Mage_Core_Model_Config_Element Object
        
(
                
[...snip...]
        
)
)

On the problematic installation it is:

Mage_Core_Model_Config_Element Object
(
    
[admin] => Mage_Core_Model_Config_Element Object
        
(
                
[...snip...]
        
)
    
[all] => Mage_Core_Model_Config_Element Object
        
(
                
[...snip...]
        
)
)

The order of the admin and all nodes is reversed.
The tree comes straight from the config xml tree, as far as I can see:

$resource Mage::getConfig()->getNode('adminhtml/acl/resources');
in app/code/core/Mage/Admin/Model/Roles.php

What can be the cause for this?
How do I change the order of config nodes?
I think the module dependencies set the order of the loading of the configuration, but without information why this is happening I can’t find a lever to start fixing it.

In both installation there are NO entries in the core_config_data table that contain “¬l%” in the config path.

There are NO extensions installed that modify the adminhtml/acl/resources part of the configuration on either installation.

Any help or any pointers would be very much appreciated!

Thanks,

Vinai

Image Attachments
screenshot.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

anybody...?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pkircher
Member
 
Avatar
Total Posts:  53
Joined:  2008-09-19
 

did u drop ur cache ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

jup…

 
Magento Community Magento Community
Magento Community
Magento Community
 
jasso
Jr. Member
 
Total Posts:  8
Joined:  2008-03-31
 

I had this problem and it was fixed by disabling an extension.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

Thanks for the replies!
I really appreciate them.

Well, it indeed was an extension (Heidelpay).
The extension doesn’t change the configuration directly, but it sets dependencies in app/etc/modules/Exanto_Heidelpay.xml

<config>
  <
modules>
    <
Exanto_Heidelpay>
      <
active>true</active>
      <
codePool>local</codePool>
      <
depends>
        <
Mage_Payment />
      </
depends>
      <
version>0.1.0</version>
    </
Exanto_Heidelpay>
  </
modules>
</
config>
Those dependencies change the load order of the modules which cause the swapped order in the config resource tree.
Disabling the module by setting <active>false</active> wasn’t enough.

Commenting out the dependencies works.

<!--
      <
depends>
        <
Mage_Payment />
      </
depends>
      -->

Oh, and I had to re-log into the admin interface so the changes took affect.

Maybe this helps somebody.

Cheers,
Vinai

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

So, looking into the bug a little more I found a solution.

The problem is the code that translates the XML config data containing the ACL into JSON Data.  There are two top level elements, <all> and <admin>.  And they are normally in that order.  The XML->JSON code takes advantage of that and assumes that is the way it will always be.  In some situations, when you add a module, the config from that module could cause <all> to actually be the second element.  So when you convert the XML into JSON at that point, it uses the <all> element instead of the <admin> element.  Since <all> has no children, you get a blank resource list.  So, below is a simple change that will fix the problem

Edit /app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php line 64 (in vanilla 1.1.6)

Before

$rootArray $this->_getNodeJson($resources);

After

$rootArray $this->_getNodeJson($resources->admin1);
 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

Thank you, Lee!
I suggest submitting this as a bug report. If you rather have me report it just let me know.

Vinai

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Already done. =)

 
Magento Community Magento Community
Magento Community
Magento Community
 
d.giuralarocca
Jr. Member
 
Total Posts:  8
Joined:  2008-09-03
 

I ran into the same problem, but my mistake was in the config.xml inside the <acl> tag. This

Before
$rootArray 
$this->_getNodeJson($resources);

After
$rootArray 
$this->_getNodeJson($resources->admin1);
is not needed
 
Magento Community Magento Community
Magento Community
Magento Community
 
BoostMyShop
Sr. Member
 
Avatar
Total Posts:  155
Joined:  2008-06-11
France
 

thanks for posting answer guies smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top