diff --git a/modules/node/node.module b/modules/node/node.module index 5a4e019..c2b0a3b 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -3445,7 +3445,16 @@ function _node_query_node_access_alter($query, $type) { } // Otherwise attach it to the node query itself. else { - $query->exists($subquery); + // If it's a left join to entity table and entity does not exist (i.e. + // entity_id is null) then skip access check. + if ($tableinfo['join type'] == 'LEFT') { + $subquery_cond = db_or(); + $subquery_cond->exists($subquery); + $subquery_cond->isNull("$nalias.$field"); + $query->condition($subquery_cond); + } else { + $query->exists($subquery); + } } } }