You are here

function domain_content_check in Domain Access 5

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

Access checking routine for the menu and node access checks.

Parameters

$domain: An array representing the currently active domain record.

$all: A boolean flag indicating whether this user can access all domains.

2 calls to domain_content_check()
domain_content_form in domain_content/domain_content.module
Rewrites node_admin_nodes() to use db_rewrite_sql().
domain_content_menu in domain_content/domain_content.module
Implement hook_menu()

File

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

Code

function domain_content_check($domain, $all) {
  global $user;

  // If the user can administer nodes, just return TRUE.
  if ($all) {
    return TRUE;
  }

  // Otherwise, the user must be able to edit domain nodes.
  if (!user_access('edit domain nodes')) {
    return FALSE;
  }
  $rule = variable_get('domain_editors', DOMAIN_EDITOR_RULE);
  $check = FALSE;
  $editor = FALSE;

  // Can this user see the default site?
  if ($rule && $domain['domain_id'] == 0 && $user->domain_user['-1'] == -1) {
    $editor = TRUE;
  }
  else {
    if ($rule && $domain['domain_id'] > 0 && $domain['domain_id'] == $user->domain_user[$domain['domain_id']]) {
      $editor = TRUE;
    }
  }
  if ($editor) {
    $check = TRUE;
  }
  return $check;
}