function revisioning_user_node_access in Revisioning 7
Same name and namespace in other branches
- 8 revisioning.module \revisioning_user_node_access()
- 6.4 revisioning.module \revisioning_user_node_access()
- 6.3 revisioning.module \revisioning_user_node_access()
Implements hook_user_node_access().
5 calls to revisioning_user_node_access()
- revisioning_form_alter in ./
revisioning.pages.inc - Implements hook_form_alter().
- revisioning_node_access in ./
revisioning.module - Implements hook_node_access().
- revisioning_scheduler_form_node_form_alter in revisioning_scheduler/
revisioning_scheduler.module - Implements hook_form_BASEFORMID_alter().
- revisioning_user_may_auto_publish in ./
revisioning_api.inc - Return whether the user has permission to auto-publish the supplied node.
- _revisioning_access_node_revision in ./
revisioning.module - Determine whether the supplied revision operation is permitted on the node.
File
- ./
revisioning.module, line 782 - Allows content to be updated and reviewed before submitting it for publication, while the current live revision remains unchanged and publicly visible until the changes have been reviewed and found fit for publication by a moderator.
Code
function revisioning_user_node_access($revision_op, $node, $account = NULL) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
$type = check_plain($node->type);
switch ($revision_op) {
case 'view current':
break;
case 'compare to current':
case 'view revisions':
case 'view revision list':
if (user_access('view revisions', $account)) {
break;
}
if (user_access('view revisions of any ' . $type . ' content', $account)) {
break;
}
if ($node->uid == $account->uid && user_access('view revisions of own ' . $type . ' content', $account)) {
break;
}
return FALSE;
case 'edit current':
return 'update';
case 'edit revisions':
case 'revert revisions':
return user_access($revision_op, $account) ? 'update' : FALSE;
case 'publish revisions':
$node_op = variable_get('revisioning_require_update_to_publish', TRUE) ? 'update' : 'view';
if (user_access('publish revisions', $account)) {
return $node_op;
}
if (user_access('publish revisions of any ' . $type . ' content', $account)) {
return $node_op;
}
if ($node->uid == $account->uid && user_access('publish revisions of own ' . $type . ' content', $account)) {
return $node_op;
}
return FALSE;
case 'unpublish current revision':
$node_op = variable_get('revisioning_require_update_to_publish', TRUE) ? 'update' : 'view';
return user_access('unpublish current revision', $account) ? $node_op : FALSE;
case 'delete revisions':
case 'delete archived revisions':
if (!user_access('delete revisions', $account)) {
return FALSE;
}
case 'delete node':
return 'delete';
default:
drupal_set_message(t("Unknown Revisioning operation '%revision_op'. Treating as 'view'.", array(
'%revision_op' => $revision_op,
)), 'warning', FALSE);
}
return 'view';
}