? alter_node_access_docs.patch Index: hooks/core.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/docs/developer/hooks/core.php,v retrieving revision 1.201 diff -u -p -r1.201 core.php --- hooks/core.php 23 Sep 2008 22:42:48 -0000 1.201 +++ hooks/core.php 29 Sep 2008 13:28:35 -0000 @@ -1250,6 +1250,37 @@ function hook_node_access_records($node) } /** + * 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