Problem/Motivation
API page: http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/...
"Note that the system makes no distinction between published and unpublished nodes."
I think that if "the system" here is referring only to the grants node_access table system, then yes, this is true. However, in the normal way of displaying a page, hook_node_access (and hook_node_grants after it) is only called for published nodes. Well, at least according to flowchart on p160 of "Pro Drupal 7 Development / Tomlinson & VanDyk".
Steps to reproduce
Proposed resolution
Remaining tasks
- The new second paragraph 'the table' is referred to without defining what table is being used.
- "realms" is kind of confusing here. It should have a definition
Review
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#45 | 1516242-45.patch | 2.75 KB | Nikhil_110 |
| |||
#32 | 1516242-32.patch | 1.89 KB | Dinesh18 |
#23 | improve-hook-node-grants-docs-1516242-23.patch | 1.89 KB | anil.gangwal |
#22 | improve-hook-node-grants-docs-1516242-22.patch | 1.88 KB | anil.gangwal |
#19 | interdiff-1516242-16-19.txt | 1.32 KB | Shreya Shetty |
Comments
Comment #1
jhodgdonGood point... There is a clearer discussion in http://api.drupal.org/api/drupal/modules%21node%21node.module/group/node...
Comment #2
jhodgdonThe code of http://api.drupal.org/api/drupal/modules%21node%21node.module/function/n... also shows the process, and how it relates to $node->status. This only applies to single-node checks though, not listings, and it is also true that hook_node_grants() doesn't distinguish between published and unpublished. So probably the hook_node_grants() docs just need to clarify that one sentence noted in the original issue report here. Probably a good Novice project...
Comment #3
lirantal CreditAttribution: lirantal commentedTo me the docs on hook_node_grants() are pretty clear but please review the following revised paragraph and see if it makes better sense and clarity for updating the docs:
How's that?
Comment #4
lirantal CreditAttribution: lirantal commentedComment #5
jhodgdonThat looks pretty good, except I'm not sure what a "private case" means, and the second sentence runs on for quite a while.
But maybe the right thing to do would be to link to the page that completely describes the node access process instead of partially duplicating what that page says? Which would be:
http://api.drupal.org/api/drupal/modules!node!node.module/group/node_acc...
And perhaps that page needs some additional text about the case described here?
Comment #6
mgiffordComment #7
finnydobson CreditAttribution: finnydobson commentedHello, I have attempted to revise the paragraph on node access rights. Please review the paragraph to see if it is explained clearly.
Comment #8
jhodgdonWhat does "node_access" mean in this sentence:
The distinction between published and unpublished nodes is clarified by node_access.
I'm confused.
Also as a note, in documentation to make a link to a topic, use something like
See @link node_access the Node Access topic @endlink for more information.
This would be easier to check in the form of a patch.
Comment #9
finnydobson CreditAttribution: finnydobson commentedThank you for your review. This is my second attempt at the paragraph. I removed node_access from my previous attempt.
And as per your comment #5 I added additional text about the case described above.
Comment #10
jhodgdonPlease make a patch.
Comment #11
ottlik CreditAttribution: ottlik commentedHere's the patch. Just copied from finnydobson and unsplit an infinitive.
Comment #12
wiifmThanks @ottlik, I have made some slight changes:
All text is the same.
Comment #13
jhodgdonThanks for the patches! I think this needs some work:
a)
This sentence needs some attention. We don't normally say that we "enable the user to" do things, and where is this option anyway? Also please do not use "his" or other gender-specific language in documentation.
b)
@link ... @endlink all needs to be on one line.
c) Generally... I am not finding this new content very easy to follow, in the context of the rest of the documentation that is already there. It seems to wander between the single-node-access check and the grant system. It needs to be more systematic.
Comment #14
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedAssembled the input from @jhodgdon and merged with patch.
Comment #15
jhodgdonThanks for reviving this issue! I think this still needs some work though... and this is probably not a novice issue really!
This paragraph has several lines that run over 80 characters, and several that end with an extra space.
There is also some awkward wording in the sentence about single-node checks, and again it shouldn't refer to "an option to the user". This is programmer documentation, not user documentation, so talk about what a programmer can do in a module and how to do it, not what a user can do in the UI.
The See sentence also needs some attention. You might need to look up how to do @link:
https://www.drupal.org/node/1354#link
Too many "and" in this sentence.
Also, ... this is unclear. The first part of this paragraph says that the node_access table and hook_node_grants() will be called. I think this is a bypass of that whole process, but that is not made clear by this sentence. Perhaps it belongs in its own paragraph, and perhaps it belongs before this paragraph about node_access table and hook_node_grants()?
Comment #16
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedI tried to give my better in this patch.
Comment #17
jhodgdonSorry, but this is still not OK. The @link formatting is still wrong, and not everything pointed out in #15 is fixed. All of the wording in there about users viewing their own unpublished content is still very very wrong and/or confusing.
Comment #18
Shreya Shetty CreditAttribution: Shreya Shetty at Trigyn Technologies Ltd commentedComment #19
Shreya Shetty CreditAttribution: Shreya Shetty at Trigyn Technologies Ltd commentedI have made some improvements
Comment #20
jhodgdonThanks for the new patch but this is still missing the point. And it still has similar problems to before....
This line goes over 80 characters.
This line has an extra space at the end.
This line goes over 80 characters.
This sentence about single-node checks still doesn't fit with this paragraph and I am not sure what it means.
Either fix it so it is right and move to its own paragraph, or (preferably) remove it.
I really don't know where this came from or why it was added.
This @link is still wrong. Please read the documentation about how to do @link that I referenced in previous reviews.
Also it is only 1 topic, not "topics".
This is a paragraph copied out of context from the node access topic. It makes no sense here.
Comment #21
anil.gangwal CreditAttribution: anil.gangwal at Publicis Sapient for Publicis Sapient commentedComment #22
anil.gangwal CreditAttribution: anil.gangwal at Publicis Sapient for Publicis Sapient commentedI have made the changes. Please review my patch.
Comment #23
anil.gangwal CreditAttribution: anil.gangwal at Publicis Sapient for Publicis Sapient commentedPlease ignore the previous on and review this patch.
Comment #24
jhodgdonMost of what I said in the previous several reviews has still not been addressed. When a patch is made that addresses *all* of the problems, please attach it to this issue and set it to Needs review. If you cannot address all the problems, ether get help from the Core Mentoring group, post a question to the issue, or find another issue to work with. Making a patch that only addresses a small part of the problems that were identified is not helpful.
Also when you make a new patch, make an interdiff file.
Thanks!
Comment #25
anil.gangwal CreditAttribution: anil.gangwal at Publicis Sapient for Publicis Sapient commentedComment #26
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedComment #27
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedBlank Spaces. Please configure your IDE for not doing this
Blank Spaces. Please configure your IDE for not doing this
Blank Spaces. Please configure your IDE for not doing this
Comment #31
Parashram CreditAttribution: Parashram commentedComment #32
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedHere is an updated patch which fixed the white space issues.
Comment #33
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedComment #35
Parashram CreditAttribution: Parashram at ]init[ AG commentedComment #43
quietone CreditAttribution: quietone commentedDiscussed in a documentation triage meeting with myself and ambermatz. Nether of us are familiar with the node grant system but we do like the additional documentation to explain the system. We also noticed a few things
The new second paragraph 'the table' is referred to without defining what table is being used.
"realms" is kind of confusing here. It should have a definition.
Needs a review from someone familiar with node grants.
Can be unassigned since it hasn't been worked on it a few years.
I have updated the IS.
Comment #45
Nikhil_110 CreditAttribution: Nikhil_110 at Srijan | A Material+ Company commentedAttached patch against Drupal 10.1.x
Comment #46
Nikhil_110 CreditAttribution: Nikhil_110 at Srijan | A Material+ Company commentedComment #47
smustgrave CreditAttribution: smustgrave at Mobomo commented#43 was not addressed.
Starting March 2023, simple rerolls, rebases, or merges will no longer receive issue credit. Only rerolls that address a merge conflict will be credited, and the merge conflict that was resolved must be documented in the text of an issue comment.
Example
error: patch failed: core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module:77
error: core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module: patch does not apply
To receive credit for contributing to this issue, assist with other outstanding tasks or unaddressed feedback.
See the issue credit guidelines for more information.