function _revisioning_node_revision_access in Revisioning 6.3
Same name and namespace in other branches
- 6.4 revisioning.module \_revisioning_node_revision_access()
Determine whether the supplied revision operation is permitted on the node. This requires getting through three levels of defence: o Is the operation appropriate for this node at this time, e.g. a node must not be published if it already is or if it isn't under moderation control o Does the user have permissions to operations of this kind in general? o Does the user have the node access rights (view/update/delete) required for this operation?
Parameters
$revision_op: For instance 'publish revisions', 'delete revisions'
$node:
Return value
bool
3 calls to _revisioning_node_revision_access()
- _revisioning_generate_node_links_according_to_permissions in ./
revisioning_theme.inc - Return an array of hyperlinks representing the operations the logged-in user is allowed to perform on the supplied node.
- _revisioning_load_op in ./
revisioning.module - _revisioning_view_edit_access_callback in ./
revisioning.module - Access callback for 'node/%', 'node/%/view' and 'node/%/edit' links that may appear anywhere on the site. At the time that this function is called the CURRENT revision will already have been loaded by the system. However…
2 string references to '_revisioning_node_revision_access'
- revisioning_menu in ./
revisioning.module - Implementation of hook_menu().
- revisioning_menu_alter in ./
revisioning.module - Implementation of hook_menu_alter().
File
- ./
revisioning.module, line 709 - Allows the creation and modification of pre-published as well as live content while the current revision remains unchanged and publicly visible until the changes have been reviewed by a moderator.
Code
function _revisioning_node_revision_access($revision_op, $node) {
if (!isset($node->num_revisions) || !isset($node->is_current)) {
drupal_set_message(t('Node object data incomplete -- have you enabled the Node Tools submodule?'), 'warning', FALSE);
}
if (!_revisioning_operation_appropriate($revision_op, $node)) {
return FALSE;
}
if (module_exists('module_grants')) {
$access = module_grants_node_revision_access($revision_op, $node);
}
else {
// Fall back to core to assess permissions (even though they suck)
$access = ($node_op = revisioning_user_node_access($revision_op, $node)) && node_access($node_op, $node);
}
return $access;
}