Node Grant Hooks

Robert Castelo's picture
hook_node_access_records()

Used to define a realm.

hook_node_grants()

Used to check if the user passes conditions specified for a grant ID.

Example Usage

A content type Life Lesson is set up.

Members over 18 years old can:

  • View Life Lesson nodes

Members over 30 can:

  • View Life Lesson nodes
  • Edit Life Lesson nodes

Members over 50 can:

  • View Life Lesson nodes
  • Edit Life Lesson nodes
  • Delete Life Lesson nodes

hook_node_access_records() is used to define who can do what.

hook_node_grants() is used to check if the user is over each age range.