O'Reilly logo

Drupal 7 Module Development by Ken Rickard, John Wilkins, Larry Garfield, Matt Butcher, Greg Dunlap, Matt Farina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

When to write a node access module

Clearly, hook_node_access() is a very powerful function. As we have seen, many common use-cases can be solved in just a few lines of code. So it is important for module developers to consider when to use hook_node_access() to implement access control as opposed to a complete node access module.

Since access control modules should not respond to the View operation, node access modules become necessary any time you need to use access rules to restrict access to the nodes that a user may view. The reason for this has to do with how Drupal builds its access controls when listing nodes. hook_node_access() is only effective for running access checks against individual nodes a fact made clear by the fact that the $node ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required