You are here

function pmteam_node_access in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmteam/pmteam.module \pmteam_node_access()
  2. 7 pmteam/pmteam.module \pmteam_node_access()
  3. 7.2 pmteam/pmteam.module \pmteam_node_access()

Implements hook_node_access().

File

pmteam/pmteam.module, line 38
Main module file for the PM Team module.

Code

function pmteam_node_access($node, $op, $account = NULL) {
  $type = is_string($node) ? $node : $node->type;
  if ($type == 'pmteam') {

    // If no account is specified, check against the currently logged in user.
    if (is_null($account)) {
      global $user;
      $account = $user;
    }
    if ($op == 'create' and user_access('Project Management Team: add', $account)) {
      return NODE_ACCESS_ALLOW;
    }
  }
  return NODE_ACCESS_IGNORE;
}