I am trying to get the name of the role of the currently logged in admin. I can get the admin user, but I can't figure out how to query their role name. The Magento docs are weak =/
$usr = Mage::getSingleton('admin/session')->getUser();
Ideas anyone?
Spoke too soon... I got the role name as follows:
$roleId = implode('', Mage::getSingleton('admin/session')->getUser()->getRoles());
$roleName = Mage::getModel('admin/roles')->load($roleId)->getRoleName();
Using this code you will get the role of current user
$admin_user_session = Mage::getSingleton('admin/session'); $adminuserId = $admin_user_session->getUser()->getUserId(); $role_data = Mage::getModel('admin/user')->load($adminuserId)->getRole()->getData(); $role_name = $role_data['role_name'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With