You are here

function domain_node_access_view in Domain Access 7.3

Checks if a user can view unpublished nodes assigned to her domain(s).

See also

domain_node_access().

File

./domain.module, line 2289
Core module functions for the Domain Access suite.

Code

function domain_node_access_view($type, $node, $op, $account) {
  domain_user_set($account);
  if (!empty($node->status)) {
    return NODE_ACCESS_IGNORE;
  }
  if (empty($node->domains) || empty($account->domain_user)) {
    return NODE_ACCESS_IGNORE;
  }
  if (!user_access('view unpublished domain content', $account)) {
    return NODE_ACCESS_IGNORE;
  }

  // The actual access check.
  foreach ($node->domains as $key => $value) {
    if (!empty($account->domain_user[$key])) {
      return NODE_ACCESS_ALLOW;
    }
  }
  return NODE_ACCESS_IGNORE;
}