Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Needs to check that $node->uid or $author->uid is not blank in either/both grant hooks.
Comments
Comment #1
Mile23Thanks.
Have a patch?
Comment #2
hefox CreditAttribution: hefox commentedNot yet, corresponding core issue #2011066: example_author from hook_node_grants/hook_node_access_records grants all anon edit/delete to uid=0 nodes
Comment #3
hefox CreditAttribution: hefox commentedComment #5
hefox CreditAttribution: hefox commentedComment #6
Mile23I'd wager that this lapse happened because there's no test of behavior for anonymous users.
Care to write one? :-)
Comment #7
Mile23Just changing the status and tags.
And clarifying: The patch looks good, just needs a regression test. If anyone ever wanted to learn how to write a test, here's your chance. :-)
Comment #8
vlad.n CreditAttribution: vlad.n commentedAdded tests, verifying the access of an anonymous user to the private nodes with known or anonymous author. Testing the nodes that don't have an author was done using the nodes that were already made in the test and removing the author and moving back to the original auther after the test. I think that these test needs more refactoring.
Comment #9
vlad.n CreditAttribution: vlad.n commentedComment #11
Mile23Great! Thanks hefox and vlad.n!
Committed: http://drupalcode.org/project/examples.git/commitdiff/b4960906e4384240c0...
Comment #12
Mile23