0

How can I remove delete customer option from a user role ? Like I have created a user role which has access to manage customers, but I do not want to give delete customer option to that particular user group/role. How can this be achieved? Is it even possible?

1 Answer 1

0

To remove delete option from any particular role you can simple put a condition around that option. First find the role of that logged in user.Then put condition according to his role. To find role of a user you can use following code.

$user = Mage::getSingleton('admin/session');
$username = $user->getUser()->getUsername();
$role_data = Mage::getModel('admin/user')->getCollection()->addFieldToFilter('username', $username)->
getFirstItem()->getRole()->getData();
$role_name = $role_data['role_name'];

Here $role_name in the role of the user.

$role = ''; //Role in which delete option will be hidded

if($role == $role_name) {
 // Do not show the delete option
} else {
//Show the option
}

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.