I'm fairly new to things Drupal so apologies in advance if this is wasting anyone's time.

I was exercising the ACL functions with the forum_access module and continuously received SQL syntax errors. The culprit appears to be in node_access_write_grants() in the block starting at line 2868 where the grant inserts are built up. The finished statement ends up taking the form:

INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (a1, a2, a3, a4, a5), (b1, b2, b3, b4, b5)

as opposed to the correct (in SQL anyway) form:

INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (a1, a2, a3, a4, a5);
INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (b1, b2, b3, b4, b5);

The fix is obvious and instant. Hope this is useful.

CommentFileSizeAuthor
#1 write-grants.patch1.78 KBSteven

Comments

Steven’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

For now, we should stick to standard SQL. Patch attached which simplifies the code and uses normal inserts.

Perhaps a multi-insert mechanism can be devised for 6.0.

dries’s picture

Code looks good but we'll want some of the node-level access gurus to test it! :)

drumm’s picture

Status: Needs review » Fixed

Tested with organic groups and committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)