You are here

function _i18n_access_node_access in Translation Access 6

Wrapper around node_access() with additional checks for language permissions.

See also

node_access()

1 call to _i18n_access_node_access()
i18n_access_translation_node_overview in ./i18n_access.module
Replacement for translation_node_overview().
1 string reference to '_i18n_access_node_access'
i18n_access_menu_alter in ./i18n_access.module
Implementation of hook_menu_alter().

File

./i18n_access.module, line 127
file_description

Code

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

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $user;
  }

  // if revisioning is enabled, check revision access
  if (function_exists('_revisioning_node_revision_access')) {
    $access = _revisioning_view_edit_access_callback($op, $node, $account);
  }
  else {
    $access = node_access($op, $node, $account);
  }

  // Bypass completely if access returns false.
  if (!$access) {
    return FALSE;
  }

  // This module doesn't deal with view permissions
  if ($op == 'view') {
    return TRUE;
  }

  // make sure that administrators always have access
  if (user_access('administer nodes', $account)) {
    return TRUE;
  }
  $perms = i18n_access_load_permissions($account);

  // Make sure to use the language neutral constant if node language is empty
  $langcode = $node->language ? $node->language : I18N_ACCESS_LANGUAGE_NEUTRAL;
  return isset($perms[$langcode]) ? (bool) $perms[$langcode] : FALSE;
}