function module_grants_menu_alter in Module Grants 6
Same name and namespace in other branches
- 6.4 module_grants.module \module_grants_menu_alter()
- 6.3 module_grants.module \module_grants_menu_alter()
Implementation of hook_menu_alter().
Modify menu items defined in other modules (in particular the node module).
File
- ./
module_grants.module, line 58 - Module to enable access control for unpublished content. Also makes sure that modules that operate on access grants behave in the expected way when enabled together.
Code
function module_grants_menu_alter(&$items) {
// As module_grants_node_access() fixes the problem of grants not being
// checked when a node isn't published, all node access menu links are
// altered to use this function.
// For normal view/edit/delete operations module_grant_node_access() is
// called directly, for the revision-specific operations the function is
// called via mode_grants_node_revision_access().
$items['node/%node']['access callback'] = 'module_grants_node_access';
$items['node/%node']['access arguments'] = array(
'view',
1,
);
$items['node/%node/view']['access callback'] = 'module_grants_node_access';
$items['node/%node/view']['access arguments'] = array(
'view',
1,
);
$items['node/%node/edit']['access callback'] = 'module_grants_node_access';
$items['node/%node/delete']['access callback'] = 'module_grants_node_access';
$items['node/%node/revisions']['access callback'] = 'module_grants_node_revision_access';
$items['node/%node/revisions']['access arguments'] = array(
'view revisions',
1,
);
// Point /%node/revisions/%/view page to same callback as /%node/view for a
// consistent view of current and other revisions
$items['node/%node/revisions/%/view']['page callback'] = 'node_page_view';
// as used by /%node/view
$items['node/%node/revisions/%/view']['page arguments'] = array(
1,
);
$items['node/%node/revisions/%/view']['access callback'] = 'module_grants_node_revision_access';
$items['node/%node/revisions/%/view']['access arguments'] = array(
'view revisions',
1,
);
$items['node/%node/revisions/%/delete']['access callback'] = 'module_grants_node_revision_access';
$items['node/%node/revisions/%/delete']['access arguments'] = array(
'delete revisions',
1,
);
$items['node/%node/revisions/%/revert']['access callback'] = 'module_grants_node_revision_access';
$items['node/%node/revisions/%/revert']['access arguments'] = array(
'revert revisions',
1,
);
}