18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Node Access<br />

Instead, core returns the NODE_ACCESS_IGNORE constant, which indicates that<br />

access to the View operation should be handled by the {node_access} table.<br />

By default, the {node_access} table contains a single record:<br />

nid gid realm grant_view grant_update grant_delete<br />

0 0 all 1 0 0<br />

This row allows the node access system to generate a default JOIN from the {node}<br />

table to the {node_access} table that will always return TRUE.<br />

However, if your site is not running any node access modules (that is, no modules<br />

that implement hook_node_grants()), then no JOIN will be required. In this case,<br />

all nodes will be returned.<br />

If you install a node access module, however, you will immediately be prompted to<br />

rebuild content access permissions for the site.<br />

Rebuilding the permissions will update the {node_access} table with the rules<br />

defined by the module(s) you have installed. When we activate the example module<br />

we will be building in this chapter, here is the result:<br />

[ 252 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!