Index: nodeaccess.module =================================================================== --- nodeaccess.module (revision 29) +++ nodeaccess.module (working copy) @@ -178,11 +178,11 @@ $nid = $form_values['nid']; $save = array(); foreach (array('uid', 'rid') as $type) { + $realm = 'nodeaccess_' . $type; + $node->nid = $nid; if (is_array($form_values[$type])) { $grants = array(); - $realm = 'nodeaccess_' . $type; foreach ($form_values[$type] as $gid => $line) { - $realm = 'nodeaccess_'. $type; // check the settings, no need for an entry if no perms are granted if ($line['grant_view'] || $line['grant_update'] || $line['grant_delete']) { $grant = array('gid' => $gid, 'realm' => $realm, 'grant_view' => $line['grant_view'], @@ -191,9 +191,8 @@ $save[] = $grant; } } - $node->nid = $nid; - node_access_write_grants($node, $grants, $realm); } + node_access_write_grants($node, $grants, $realm); } // save it to our own table, thanks to the new api.... _nodeaccess_save_new($nid, $save);