? hook_node_access_records.patch ? sites/default/files Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1008 diff -u -p -r1.1008 node.module --- modules/node/node.module 31 Dec 2008 12:02:22 -0000 1.1008 +++ modules/node/node.module 31 Dec 2008 21:17:49 -0000 @@ -2359,6 +2359,12 @@ function node_query_alter(QueryAlterable * called by modules whenever something other than a node_save causes * the permissions on a node to change. * + * After the default grants have been loaded, we allow modules to alter + * the grants array by reference. This hook allows for complex business + * logic to be applied when integrating multiple node access modules. + * + * @see hook_node_access_records() + * * This function is the only function that should write to the node_access * table. * @@ -2367,11 +2373,14 @@ function node_query_alter(QueryAlterable */ function node_access_acquire_grants($node) { $grants = module_invoke_all('node_access_records', $node); + // Let modules alter the grants. + drupal_alter('node_access_records', $grants); + // If no grants are set, then use the default grant. if (empty($grants)) { $grants[] = array('realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0); } else { - // retain grants by highest priority + // Retain grants by highest priority. $grant_by_priority = array(); foreach ($grants as $g) { $grant_by_priority[intval($g['priority'])][] = $g;