| Project: | Drupal core |
| Version: | 7.17 |
| Component: | node.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
Hi,
What seems to happen :
In function _node_query_node_access_alter(), when it try to found a node table in joined tables (so it isn't the base table), it doesn't care about outer join. As a result, it will try to join a null nid on node access table which will exclude it...
What is expected :
- retrieve the row from outer join anyway rather than exclude a nid which doesn't exists...
How to reproduce it :
- First of all, have a least one grants node enable...
- execute the query with a user which doesn't have bypass access
- have a query to lists users which could have a reference on a node or not. So base table is "users". And we have an outer join on node table (left join for example).
- tag this query with "node_access". Query tag node access will set conditions without taking care of the outer join.
To conclude, it should be great that node access subquery is added to the query into a conditional "or" with a check on null nid field if join type is outer like :
db_or()->isNull("$nalias.$field")->exists($subquery);
In that way, if the row joined with node table is null, it won't "execute" subquery which will exclude it.
Here is a quick and simple patch which really needs work and improvement ! This is just a fully untested patch which do the tricks in my use case (describe above)...
thanks you
Comments
#1