--- menu_per_role.module	2007-05-31 05:41:03.000000000 -0400
+++ menu_per_role_new.module	2007-06-04 14:19:37.000000000 -0400
@@ -53,10 +53,35 @@ function menu_per_role_form_alter($form_
     $form['submit']['#weight'] = 10;
     $form['#submit']['menu_per_role_form_submit'] = array();
   } 
+  // add to the default node_form
+  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
+    $form['menu']['menu_per_role'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Restrict access permission'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#weight' => 5,
+    );
+    $form['menu']['menu_per_role']['roles'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Restrict access to only these roles'),
+      '#options' => user_roles(),
+      '#default_value' => $form['menu']['mid']['#value'] ? menu_per_role_get_roles($form['menu']['mid']['#value']) : array(),
+      '#description' => t('Check no role to leave the access permission to the default.'),
+    );
+    $form['submit']['#weight'] = 10;
+    $form['#submit']['menu_per_role_form_submit'] = array();
+  }   
 } 
 
- 
 function menu_per_role_form_submit($form_id, $form_values) {
+  // if coming from node_form, the array is nested
+  if (isset($form_values['menu']['menu_per_role'])) {
+    if ($form_values['menu']['mid'] > 0) { // this accounts for new node creation
+      $form_values['mid'] = $form_values['menu']['mid'];
+    }  
+    $form_values['roles'] = $form_values['menu']['menu_per_role']['roles'];
+  }
   if ($form_values['mid']) {
     db_query("DELETE FROM {menu_per_role} WHERE mid = %d", $form_values['mid']);
   }
@@ -70,4 +95,3 @@ function menu_per_role_form_submit($form
     }
   }
 }
-
