node_access_example.module

Wersja 1.8 (checked in on 2007/09/09 at 01:27:07 by yched)

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:

<?php

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

?>

Funkcje

NazwaOpis
node_access_example_form_alterImplementation of hook_form_alter()
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().

Dodaj nową odpowiedź

  • Adresy internetowe są automatycznie zamieniane w odnośniki, które można kliknąć.
  • Dozwolone znaczniki HTML: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Znaki końca linii i akapitu dodawane są automatycznie.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

Więcej informacji na temat formatowania

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.