You are here

function domain_content_check in Domain Access 7.2

Same name and namespace in other branches
  1. 5 domain_content/domain_content.module \domain_content_check()
  2. 6.2 domain_content/domain_content.module \domain_content_check()
  3. 7.3 domain_content/domain_content.module \domain_content_check()

Access checking routine for menu and node editing checks.

Parameters

$domain_id: An id representing the currently active domain record.

Return value

Boolean true or false.

1 string reference to 'domain_content_check'
domain_content_menu in domain_content/domain_content.module
Implements hook_menu()

File

domain_content/domain_content.module, line 122
Editorial overview module.

Code

function domain_content_check($domain_id) {
  global $user;

  // If the user can bypass node access, just return TRUE.
  if (user_access('bypass node access') || user_access('review content for all domains')) {
    return TRUE;
  }

  // Otherwise, the user must be able to edit domain nodes.
  $rule = user_access('edit domain content');
  if (!$rule) {
    return FALSE;
  }
  $domains = domain_get_user_domains($user);
  $key = $domain_id == 0 ? -1 : $domain_id;

  // Can this user see the requested site?
  if (!empty($domains[$key])) {
    return TRUE;
  }
  return FALSE;
}