node_access_example.module

Version

1.4.4.3 (checked in on 2006/11/17 at 21:14:17 by drewish)

Description

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

Database definition:

<?php

DELETE FROM node_access;
INSERT INTO node_access (nid, gid, realm, grant_view, grant_update,
grant_delete) VALUES (0, 1, 'example', 1, 0, 0)

?>

This SQL needs to be run before the module will work properly. The installer system will probably perform this work in the future. The first line removes any existing grants, including (most importantly) the universal grant installed by default that gives read access to every node for everyone. The second line grants read access to every node for users with the "access private content" permission; in the scheme we're defining here, each node will either be private (in which case it can always be read by anyone with that permission) or public (in which case it can be read by everyone). We'll take care of public nodes in node_access_example_nodeapi().

Functions

Namesort iconDescription
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_grantsImplementation of hook_node_grants().
node_access_example_permImplementation of hook_perm().
 
 

Drupal is a registered trademark of Dries Buytaert.