Magento hide or remove Delete Customer button in admin

For a customer we had to hide or remove the Delete customer button for non administrators. Just to avoid that CMS users could delete customers by accident.

This is done by extending the Mage_Adminhtml_Block_Customer_Edit clas

File: app/code/core/Mage/Adminhtml/Block/Customer/Edit.php

Code used to get current users role:

$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 ($role_name != ‘Administrators’) {

Add this code just below

if (!Mage::registry(‘current_customer’)->isDeleteable()) {

So, what do you think ?