function i18n_access_node_access in Translation Access 7
Wrapper around node_access() with additional checks for language permissions.
See also
File
- ./
i18n_access.module, line 174 - file_description
Code
function i18n_access_node_access($node, $op, $account = NULL) {
if (is_object($node)) {
global $user;
// If no user object is supplied, the access check is for the current user.
if (empty($account)) {
$account = $user;
}
// Bypass completely if node_access returns false.
//TODO $access = node_access($node, $op, $account);
/* TODO if (!$access) {
return FALSE;
} */
// This module doesn't deal with view permissions
if ($op == 'view') {
return NODE_ACCESS_IGNORE;
}
// make sure that administrators always have access
if (user_access('administer nodes', $account)) {
return TRUE;
}
$perms = i18n_access_load_permissions($account->uid);
// 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] : NODE_ACCESS_DENY;
return isset($perms[$langcode]) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
}
}