We had a bunch of websites all using the same views. They all worked fine except for one, which could not load the nid of the nodes it was trying to select. After much head-scratching, I realised the only difference was Nodeaccess! I uninstalled the module and, hey presto, everything was fine. Somehow Nodeaccess was interfering with the Views module's ability to load nodes.

I was logged in as uid 1, so I should have had full access to everything.

Comments

mrf’s picture

I was seeing this as well.

I uninstalled this module, and now new content that I create, or content that I edit is not making the correct entry in the original node_access table.

Visiting admin/content/node-settings and rebuilding my permissions table fixed the problem for me.

greg.harvey’s picture

Ok, but you never got it working with Nodeaccess at all then? You gave up and uninstalled?

I'm trying to understand if the bug stands, or if you found a fix... =)

mrf’s picture

I guess my issue is slightly different. Everything was working correctly for me until I uninstalled the module, then access control started breaking.

Did you try rebuilding the permissions table while you had the module installed? That might fix your issue as well, I'm guessing that this permission table has a tendency to get messed up since there is a facility in core to repair it.

greg.harvey’s picture

I did, but I should probably try again. At the moment several modules are a little out of date, so next time we do a spot of housekeeping and update everything I'll try Nodeaccess again, and make sure I rebuild permissions several times.

For now though this bug remains open. Not that anyone seems to care! ;-)

awolfey’s picture

This may be related. I'm getting a sql error on a view using arguments after installing nodeaccess. It was working before.

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid), node.title AS node_title, node_data_field_version.fiel' at line 1 query: execute /* Anonymous : execute */ SELECT DISTINCT(node.nid) AS DISTINCT(node.nid), node.title AS node_title, node_data_field_version.field_version_value AS node_data_field_version_field_version_value, node_data_field_version.nid AS node_data_field_version_nid, node.type AS node_type, node.uid AS node_uid, node.comment AS node_comment, node_revisions.format AS node_revisions_format, node.changed AS node_changed, node.vid AS node_vid, node_revisions.body AS node_revisions_body, node_data_field_version.field_preview_fid AS node_data_field_version_field_preview_fid, node_data_field_version.field_preview_list AS node_data_field_version_field_preview_list, node_data_field_version.field_preview_data AS node_data_field_version_field_preview_data, node_data_field_version.field_html_fid AS node_data_field_version_field_html_fid, node_data_field_version.field_html_list AS node_data_field_version_field_html_list, node_data_field_version.field_html_data AS node_data_field_version_field_html_data, node.created AS node_created FROM node node LEFT JOIN term_node term_node ON node.vid = term_node.vid INNER JOIN term_data term_data ON term_node.tid = term_data.tid LEFT JOIN content_type_job node_data_field_version ON node.vid = node_data_field_version.vid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'nodeaccess_rid') OR (na.gid = 0 AND na.realm = 'nodeaccess_uid') OR (na.gid = 0 AND na.realm = 'nodeaccess_author'))) AND ( (node.type in ('job')) AND (term_data.name = 'snappyprinting') )ORDER BY node_changed DESC, node_created DESC in /home/user/public_html/d6test/sites/all/modules/views/includes/view.inc on line 727.

The error also occurs when logged in as user 1.

tyromind’s picture

Ditto here.

Installed Nodeaccess, showed the message that permissions needed to be rebuilt - as soon as I did that I started getting similar messages as awolfey - specifically I have a views block listing a few events, and it died. I disabled the module, and all is well again. I checked the permissions page, all looks correct... I checked the node access page, same.

For now - it will stay disabled

agentrickard’s picture

You can't make a View 'DISTINCT' when running a node access module, because node access also adds a DISTINCT.

greg.harvey’s picture

Hmm, for now it's hard to say who should "fix" this. Right now neither module is core, but my gut feeling is Nodeaccess ought to be smart enough to know it is loading a view and make sure it doesn't double-DISTINCT, as Views will soon be core by all accounts, and when it is, this will be a Nodeaccess bug. =(

Anonymous’s picture

Status: Active » Closed (won't fix)

I don't think there is anything this module can do about it and my guess is that any other access modules will have the same problem. This module does not actually do anthing in terms of querying or loading nodes. All it does is populate entries in drupal's built in access tables. When it comes to loading or querying nodes, this module doesn't do anything, drupal handle's that all based on the access table entries. If there's a glitch with this, I think the bug should be filed against either drupal core or views.

greg.harvey’s picture

Fair enough. Any volunteers to open that issue?? I can, but not now as it's nearly midnight and I'm going to bed! =)