Index: search_block.module
===================================================================
--- search_block.module	(revision 918)
+++ search_block.module	(working copy)
@@ -6,7 +6,14 @@
  * This module allows for the removal of individual nodes or
  * entire content types from the search index.
  */
- 
+
+/**
+ * Implementation of hook_perm in order to restrict function to trusted users.
+ */
+function search_block_perm() {
+  return array('block searches');
+}
+
  /**
   * Implementation of hook_form_alter
   */
@@ -17,9 +24,6 @@
   elseif (isset($form['old_type'])) {
     $type = $form['old_type']['#value'];
   }
-  else {
-    return;
-  }
   
   $enabled = variable_get('search_block_'. $type, FALSE);
 
@@ -43,27 +47,37 @@
     // This is not shown if the content is globally blocked
     // Perhaps we want to include the reverse option (index a single node)?
     case $type . '_node_form':
-      $form['search_block_set'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Search Block'),
-        '#collapsible' => TRUE,
-        '#collapsed' => TRUE,
-      );
-      if(!$enabled) {
-        $form['search_block_set']['search_block'] = array(
-          '#type' => 'checkbox',
-          '#title' => t('Block this node from the search index'),
-          '#default_value' => $form['#node']->search_block,
-          '#description' => t('Enable this option to hide this node from the search index.'),
+      if (user_access('block searches')) {
+        $form['search_block_set'] = array(
+          '#type' => 'fieldset',
+          '#title' => t('Search Block'),
+          '#collapsible' => TRUE,
+          '#collapsed' => TRUE,
         );
+        if(!$enabled) {
+          $form['search_block_set']['search_block'] = array(
+            '#type' => 'checkbox',
+            '#title' => t('Block this node from the search index'),
+            '#default_value' => $form['#node']->search_block,
+            '#description' => t('Enable this option to hide this node from the search index.'),
+          );
+        }
+        else {
+          // We need the divs otherwise the fieldset misrenders
+          $form['search_block_set']['notice'] = array(
+            '#prefix' => '<div>',
+            '#suffix' => '</div>',
+            '#value' => t('This content type is globally blocked from searches.'),
+          );
+        }
       }
-      else {
-        // We need the divs otherwise the fieldset misrenders
-        $form['search_block_set']['notice'] = array(
-          '#prefix' => '<div>',
-          '#suffix' => '</div>',
-          '#value' => t('This content type is globally blocked from searches.'),
-        );
+      break;
+      
+    case 'search_form':
+      foreach ($form['advanced']['type']['#options'] as $type2 => $name) {
+        if (variable_get('search_block_'. $type2, FALSE)) {
+          unset($form['advanced']['type']['#options'][$type2]);
+        }
       }
       break;
    }
