I want to fetch all resource id(s) list programmatically in foreach loop. In System > Permission > Roles > Administrator .
In Role Resources Tab and select custom option from dropdown It will display all resources.This All resources want to fetch programmatically.

How can I do this ?

3 Answers 3


Take a look at app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php. Look for method getResTreeJson. This method returns a json array of all resources.

Also you can just call this code:

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

It returns a Varien_Simplexml_Element object.

  • Now I can fetch all resource list.Thanks for hint Commented Dec 13, 2015 at 12:35

To have a list of the resources you can call this code:

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

This will return an array with all the path of the resources.

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

for more information refer a http://sonimanthan228.blogspot.in/2015/12/fetch-all-resource-list-in-magento-by.html

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.