Examples of hooks:

hook_node_grants: https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function...
hook_node_access_records: https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function...

Are supossed to be related, but are not consistent. In the first one, it uses 'example_owner' realm, but in the second one, it uses 'example_author' realm.

Comments

grisendo’s picture

Status: Needs work » Needs review
Issue tags: +Node access, +Node Access Example, +API, +API consistency
StatusFileSize
new452 bytes

I attach a patch.

Decided to keep 'example_author' over 'example_owner' since is the word used in foreign keys in node module tables.

dcam’s picture

Version: 7.x-dev » 8.0.x-dev
Status: Needs review » Needs work
Issue tags: -Node access, -Node Access Example, -API, -API consistency

This code is still present in Drupal 8, so it would have to be changed there first.

pushpinderchauhan’s picture

Status: Needs work » Needs review
StatusFileSize
new512 bytes

Here is patch for D8. Please review patch.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Great idea, and both the D7 and D8 patches look good, thanks!

  • jhodgdon committed 525a46c on 8.0.x
    Issue #2318981 by er.pushpinderrana, grisendo: Make hook_node_grants and...
jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks again! Committed appropriate patches to 8.0.x and 7.x.

  • jhodgdon committed b558549 on 7.x
    Issue #2318981 by grisendo: Make hook_node_grants and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.