Closed (outdated)
Project:
Nodeaccess
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jul 2015 at 20:23 UTC
Updated:
9 Oct 2025 at 09:28 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
joelpittetHere's some tests, they should fail:) I don't have a solution to the problem yet but this should help ensure it works going forward.
First time writing tests before I know the answer:)
Comment #3
joelpittetThose two fails are expected;)
Comment #4
joelpittetActually I should leave this as needs-work because the fix needs to be added to these tests.
Comment #5
joelpittetBump, there are tests to show this is broken, bumping priority.
Comment #6
nick dewitte commentedAttached is a patch that resolves this specific issue in a very naive way.
When this module saves grants, this is done via nodeaccess_set_grants().
This function calls node_access_acquire_grants(), which calls all implementations of hook_node_access_records().
The nodeaccess_node_access_records() implementation (which is the file I patched) checked if the node was unpublished,
and if so, it returned no grants (NULL).
After reading https://api.drupal.org/api/drupal/modules%21node%21node.module/group/nod...
it appears to me that the access based on the published state should be managed in hook_node_access().
Once grants are being checked, I don't think it's appropriate to flat out deny access to all unpublished nodes without any condition.
But perhaps ignoring the published state as this patch does isn't the way to go either?
Adding the "Needs committer feedback" tag since I think this is dependant on how the module should behave.
Comment #8
joelpittetI wrote tests in #1 see if they pass with that fix.
Comment #9
alisonThank you @nick.dewitte and @joelpittet!
So, we need a version of the patch that has the fix and the tests, ya?
More broadly, though:
@nick.dewitte Are you saying that the patch you provided,
(1) allows the grants settings form to be saved (yay), and
(2) means that the grants settings from nodeaccess module will not have any impact on whether a user an see the node if it is unpublished, that determination is left up to whatever unpublished content perms exist on the site?
(Is that an accurate explanation, or?)
I think I'm fine with that concept. I'm ok with hearing other opinions, too, but it seeeeems logical to me that, unless additional nodeaccess-based permissions are added to account for viewing unpublished content (i.e. "view" + "edit" + "delete" + a new "view unpublished" perm), nodeaccess should not impact access to unpublished content. And, that feeeeeels like a safer setup -- I don't think people would want users with "view" access to automatically be able to view unpublished content -- right?
Comment #10
d.fisher commentedDrupal 7 security support has ended as of 5 January 2025.
We are doing some housekeeping on the nodeaccess issue queue and moving all Drupal 7 issues to "postponed (maintainer needs more info)". See https://www.drupal.org/project/nodeaccess/issues/3516593.
If this issue persists on the latest dev branch of nodeaccess (2.0.x-dev) then please feel free to comment and we will change the version against this issue. If we do not hear any feedback within 2 weeks (9th October 2025) we will go ahead and close this issue as outdated.
Thank you.
Comment #11
d.fisher commentedAs per the above, as there has been no response we will now close this issue as outdated.
If this issue persists on the latest dev branch of nodeaccess (2.0.x-dev) then please feel free to update the version on this issue and reopen it.
Thank you.