--- adminrole.module	2009-11-25 21:44:54.000000000 +0100
+++ adminrole.module.new	2010-07-14 20:12:52.000000000 +0200
@@ -11,6 +11,12 @@
  * Implement hook_form_FORM_ID_alter().
  */
 function adminrole_form_user_admin_settings_alter(&$form, $form_state) {
+  
+  // Check if the user is allowed to set the admin role
+  if(!user_access('set admin role')) {
+    return;
+  }
+
   // Administrative role option.
   $form['admin_role'] = array(
     '#type' => 'fieldset',
@@ -56,3 +62,11 @@
     }
   }
 }
+
+/**
+ * Implement the hook_perm().
+ */
+function adminrole_perm() {
+  return array('set admin role');
+}
+
