function _revisioning_access_node_revision in Revisioning 7
Same name and namespace in other branches
- 8 revisioning.module \_revisioning_access_node_revision()
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 permission for the requested REVISION operation? o Does the user have the NODE access rights (view/update/delete) for this operation?
Parameters
string $revision_op: For instance 'publish revisions', 'delete revisions'
object $node: The node object
Return value
bool TRUE if the user has access
7 calls to _revisioning_access_node_revision()
- revisioning_get_revisions in ./
revisioning_api.inc - Get list of revisions accessible to the logged-in user via the operation.
- revisioning_ux_page_alter in revisioning_ux/
revisioning_ux.module - Implements hook_page_alter().
- _revisioning_form_submit in ./
revisioning.pages.inc - Handler for the 'Save' button on the edit form.
- _revisioning_generate_node_links_according_to_permissions in ./
revisioning_theme.inc - Get link operations.
- _revisioning_load_op in ./
revisioning.module - Load a revision.
3 string references to '_revisioning_access_node_revision'
- revisioning_menu in ./
revisioning.module - Implements hook_menu().
- revisioning_menu_alter in ./
revisioning.module - Implements hook_menu_alter().
- revisioning_ux_menu in revisioning_ux/
revisioning_ux.module - Implements hook_menu().
File
- ./
revisioning.module, line 954 - 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_access_node_revision($revision_op, $node) {
if (!_revisioning_operation_appropriate($revision_op, $node)) {
return FALSE;
}
// Check the revision-aspect of the operation.
$node_op = revisioning_user_node_access($revision_op, $node);
// ... then check with core to assess node permissions
// node_access will invoke hook_node_access(), i.e. revisioning_node_access().
$access = $node_op && node_access($node_op, $node);
// Let other modules override the outcome, if there are any.
// If any module denies access that is the final result, otherwise allow.
$overrides = module_invoke_all('revisioning_access_node_revision', $revision_op, $node);
return empty($overrides) ? $access : !in_array(NODE_ACCESS_DENY, $overrides, TRUE);
}