You are here

function state_flow_menu_node_access in State Machine 7.3

Same name and namespace in other branches
  1. 7 modules/state_flow/state_flow.module \state_flow_menu_node_access()
  2. 7.2 modules/state_flow/state_flow.module \state_flow_menu_node_access()

Menu access callback for accessing the node workflow pages.

3 calls to state_flow_menu_node_access()
state_flow_access in modules/state_flow/state_flow.module
Determine whether a user has permission to transition a node with an event.
state_flow_events_revisions_access in modules/state_flow/state_flow.module
Menu access callback for the node revision workflow transition page.
state_flow_handler_field_workflow_link::render in modules/state_flow/includes/views/state_flow_handler_field_workflow_link.inc
Render the field.
1 string reference to 'state_flow_menu_node_access'
state_flow_menu in modules/state_flow/state_flow.module
Implements hook_menu().

File

modules/state_flow/state_flow.module, line 347
An implementation of node revision workflow for Drupal based on the State Machine system.

Code

function state_flow_menu_node_access($node, $account = NULL) {
  global $user;

  // If no user account is given, then use the current user.
  if (empty($account)) {
    $account = $user;
  }

  // If the user has the "manage content workflow" permission, then allow access
  // to workflow pages.
  $has_access = user_access('manage content workflow', $account);

  // Check to see if node type is ignored.
  $is_ignored = state_flow_entity_load_state_machine($node, 'node')
    ->ignore();
  if ($has_access && !$is_ignored) {
    $access = TRUE;
  }
  else {
    $access = FALSE;
  }

  // Allow other modules to alter this decision.
  drupal_alter('state_flow_menu_node_access', $access, $node, $account);
  return $access;
}