如何判断Magento用户是否是管理员?


How can I tell whether a Magento user is an administrator?

我正在使用Magento 1.5,我需要检查当前登录的用户是否是admin用户。我需要从用户端检查这一点,因为我需要为成员执行一个流程,该流程取决于他们是否是管理员用户。

这在Magento中是可能的吗?

Mage::getSingleton('admin/session')->getUser();

Mage::app()->getStore()->isAdmin();

试试,

$admin = Mage::getModel('customer/session')->getAdmin();
if($admin->getId() != '') {//Admin is logged in}
Mage::getSingleton('adminhtml/session')->getUser();