18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Node Access<br />

If the $diff array is empty, then the two users have the same roles and can be<br />

considered peers.<br />

if (empty($diff)) {<br />

return NODE_ACCESS_ALLOW;<br />

}<br />

Finally, we want to change our default return value, since our rule #4 indicated we<br />

want strict access control enforced. So if the diff returns a value, we deny access:<br />

return NODE_ACCESS_DENY;<br />

And that's the entire module. 17 lines of code:<br />

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

Saved successfully!

Ooh no, something went wrong!