I am using hook_node_grants to provide access to a realm based on whether someone is an 'owner' of a node. The issue is that menu_get_object() may call hook_node_grants recursively.
function hottopics_node_grants($account, $op) {
$grants = array();
...
try {
$node = menu_get_object();
} catch (Exception $e) {
// URL mustn't be the correct format.
return $grants;
}
...
// Is the person a member of the administrator group, or the owner of the parent node?
if (module_invoke('hottopicsresearch', 'display_moderated_research_access_callback', 'update', $node)) {
$grants['view_hottopics_manager'] = array(1);
}
return $grants
The code recurses at $node = menu_get_object(). Drupal-7.