1.6 (checked in on 2006/11/21 at 03:49:35 by jvandyk)
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)
)
| Name | Description |
|---|---|
| node_access_example_disable | Implementation of hook_disable(). |
| node_access_example_disabling | Simple function to make sure we don't respond with grants when disabling ourselves. |
| node_access_example_enable | Implementation of hook_enable(). |
| node_access_example_form_alter | Implementation of hook_form_alter() |
| node_access_example_help | Implementation of hook_help(). |
| node_access_example_nodeapi | Implementation of hook_nodeapi(). |
| node_access_example_node_access_records | Implementation of hook_node_access_records(). |
| node_access_example_node_grants | Implementation of hook_node_grants(). |
| node_access_example_perm | Implementation of hook_perm(). |