You are here

function _workbench_moderation_moderate_access in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.module \_workbench_moderation_moderate_access()

Checks if a user may make a particular transition on a node.

Parameters

$node: The node being acted upon.

$state: The new moderation state.

Return value

Booelan TRUE or FALSE.

2 calls to _workbench_moderation_moderate_access()
workbench_moderation_moderate_form_submit in ./workbench_moderation.module
workbench_moderation_set_state_action in ./workbench_moderation.module
Changes the moderation state for a given node.
1 string reference to '_workbench_moderation_moderate_access'
workbench_moderation_menu in ./workbench_moderation.module
Implements hook_menu().

File

./workbench_moderation.module, line 547
Content moderation for Workbench.

Code

function _workbench_moderation_moderate_access($node, $state) {
  global $user;
  $my_revision = $node->workbench_moderation['my_revision'];
  $next_states = workbench_moderation_states_next($my_revision->state, $user, $node);
  $access = node_access('update', $node, $user) && $my_revision->is_current && !empty($next_states) && isset($next_states[$state]);

  // this state is in the available next states
  // Allow other modules to change our rule set.
  $op = 'moderate';
  drupal_alter('workbench_moderation_access', $access, $op, $node);
  return $access;
}