Index: modules/node/node.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.api.php,v retrieving revision 1.5 diff -u -r1.5 node.api.php --- modules/node/node.api.php 29 Dec 2008 16:03:56 -0000 1.5 +++ modules/node/node.api.php 30 Dec 2008 09:56:54 -0000 @@ -109,6 +109,36 @@ } /** + * Alter permissions for a node to be written to the database. + * + * Node access modules establish rules for access to content. + * Before node access records are saved to the database, this hook + * is called and allows modules to modify the grants array by reference. + * This hook allows developers to write custom modules which alter the + * ways that mutliple node access modules interact. The preferred use of + * this hook is in a module that bridges mutliple node access modules + * with a configurable behavior, as shown in the example by the variable + * 'example_alter_node_access'. + * + * @param &$grants + * The $grants array returned by hook_node_access_records. + * + * @ingroup node_access + */ +function hook_node_access_records_alter(&$grants) { + // Check to see if we have enabled complex behavior. + if (variable_get('example_alter_node_access'), FALSE) && !empty($grants)) { + // Our module removes the author grant. + foreach ($grants as $gid => $grant) { + if ($grant['realm'] == 'example_author') { + unset($grants[$gid]); + } + } + sort($grants); + } +} + +/** * Add mass node operations. * * This hook enables modules to inject custom operations into the mass operations