Commit a4befbb6 authored by Dries's avatar Dries
Browse files

- Patch #18123 by chx: the $return['distinct'] in the past should have been...

- Patch #18123 by chx: the $return['distinct'] in the past should have been module_implements('node_grants') but after JonBob's node_access_view_all_nodes, that part happens only if node_grants is in effect, so it is simplified to 1.
parent 36593073
......@@ -1868,13 +1868,11 @@ function node_access($op, $node = NULL, $uid = NULL) {
* An SQL join clause.
*/
function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
if (!module_implements('node_grants') || user_access('administer nodes')) {
if (user_access('administer nodes')) {
return '';
}
$sql = 'INNER JOIN {node_access} '. $node_access_alias;
$sql .= ' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
return $sql;
return 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
}
/**
......@@ -1889,7 +1887,7 @@ function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
* An SQL where clause.
*/
function node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
if (!module_implements('node_grants') || user_access('administer nodes')) {
if (user_access('administer nodes')) {
return;
}
......@@ -1961,7 +1959,7 @@ function node_db_rewrite_sql($query, $primary_table, $primary_field) {
if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
$return['join'] = node_access_join_sql();
$return['where'] = node_access_where_sql();
$return['distinct'] = !empty($return['join']);
$return['distinct'] = 1;
return $return;
}
}
......
......@@ -1868,13 +1868,11 @@ function node_access($op, $node = NULL, $uid = NULL) {
* An SQL join clause.
*/
function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
if (!module_implements('node_grants') || user_access('administer nodes')) {
if (user_access('administer nodes')) {
return '';
}
$sql = 'INNER JOIN {node_access} '. $node_access_alias;
$sql .= ' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
return $sql;
return 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid';
}
/**
......@@ -1889,7 +1887,7 @@ function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
* An SQL where clause.
*/
function node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
if (!module_implements('node_grants') || user_access('administer nodes')) {
if (user_access('administer nodes')) {
return;
}
......@@ -1961,7 +1959,7 @@ function node_db_rewrite_sql($query, $primary_table, $primary_field) {
if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
$return['join'] = node_access_join_sql();
$return['where'] = node_access_where_sql();
$return['distinct'] = !empty($return['join']);
$return['distinct'] = 1;
return $return;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment