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();
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();
Here's another one that may be a little friendlier:
$acl = Mage::getResourceModel('admin/acl')->loadAcl(); $acl->isAllowed($user->getAclRole(), 'admin/foo/bar'));
That will return a boolean.
$user is an