node_access_example.module

Version 1.18 (checked in on 2009/10/13 at 21:21:52 by salvis)

This is an example illustrating how to restrict access to nodes based on some criterion associated with the user.

This example module will simply set a single flag on a node: 'private'. If the flag is set, only users with the 'view private content' flag can see the node, and all users with 'edit private content' can edit (but not delete) the node.

Additionally we will ensure that the node author can always view, edit, and delete the node by providing an additional access realm that grants privileges to the node's author.

Functions

NameDescription
node_access_example_form_alterImplementation of hook_form_alter()
node_access_example_node_access_explainImplementation of hook_node_access_explain().
node_access_example_node_access_recordsImplementation of hook_node_access_records().
node_access_example_node_delete
node_access_example_node_grantsImplementation of hook_node_grants().
node_access_example_node_insertImplementation of hook_node_insert().
node_access_example_node_load
node_access_example_node_updateImplementation of hook_node_update().
node_access_example_permissionImplementation of hook_permission().
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.