function revisioning_user_node_access in Revisioning 6.4
Same name and namespace in other branches
- 8 revisioning.module \revisioning_user_node_access()
- 6.3 revisioning.module \revisioning_user_node_access()
- 7 revisioning.module \revisioning_user_node_access()
Implementation of hook_user_node_access().
Parameters
$revision_op: node or revision operation e.g. 'view revisions'
$node:
Return value
the associated node operation required for this revision_op, or FALSE if access to the node is to be denied. Valid node operations to return are 'view', 'update', 'delete'.
See also
module_grants_node_revision_access()
1 call to revisioning_user_node_access()
- _revisioning_node_revision_access in ./
revisioning.module - 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…
File
- ./
revisioning.module, line 523 - 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_user_node_access($revision_op, $node) {
global $user;
switch ($revision_op) {
case 'view current':
break;
case 'compare to current':
case 'view revisions':
case 'view revision list':
if (user_access('view revisions', $user)) {
// node.module
break;
}
$type = check_plain($node->type);
if (user_access('view revisions of any ' . $type . ' content', $user)) {
break;
}
if ($node->uid == $account->uid && user_access('view revisions of own ' . $type . ' content', $user)) {
break;
}
return FALSE;
case 'edit current':
return 'update';
case 'edit revisions':
case 'revert revisions':
return user_access($revision_op, $user) ? 'update' : FALSE;
case 'publish revisions':
case 'unpublish current revision':
return user_access($revision_op, $user) ? 'view' : FALSE;
case 'delete revisions':
if (!user_access($revision_op, $user)) {
return FALSE;
}
case 'delete node':
return 'delete';
default:
drupal_set_message("Unknown Revisioning operation '{$revision_op}'. Treating as 'view'.", 'warning', FALSE);
}
return 'view';
}