node_access_example.module

Version

1.6 (checked in on 2006/11/21 at 03:49:35 by jvandyk)

Description

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.

Database definition:

CREATE TABLE node_access_example (
nid int(10) unsigned NOT NULL default '0' PRIMARY KEY,
private int,
KEY `node_example_nid` (nid)
)

Functions

Namesort iconDescription
node_access_example_disableImplementation of hook_disable().
node_access_example_disablingSimple function to make sure we don't respond with grants when disabling ourselves.
node_access_example_enableImplementation of hook_enable().
node_access_example_form_alterImplementation of hook_form_alter()
node_access_example_helpImplementation of hook_help().
node_access_example_nodeapiImplementation of hook_nodeapi().
node_access_example_node_access_recordsImplementation of hook_node_access_records().
node_access_example_node_grantsImplementation of hook_node_grants().
node_access_example_permImplementation of hook_perm().