diff options
Diffstat (limited to 'modules/node/node.api.php')
-rw-r--r-- | modules/node/node.api.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 41dcdcae7..6e215e33a 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -143,6 +143,38 @@ * module's responsibility to provide appropriate realms to limit access to * unpublished content. * + * Node access records are stored in the {node_access} table and define which + * grants are required to access a node. There is a special case for the view + * operation -- a record with node ID 0 corresponds to a "view all" grant for + * the realm and grant ID of that record. If there are no node access modules + * enabled, the core node module adds a node ID 0 record for realm 'all'. Node + * access modules can also grant "view all" permission on their custom realms; + * for example, a module could create a record in {node_access} with: + * @code + * $record = array( + * 'nid' => 0, + * 'gid' => 888, + * 'realm' => 'example_realm', + * 'grant_view' => 1, + * 'grant_update' => 0, + * 'grant_delete' => 0, + * ); + * drupal_write_record('node_access', $record); + * @endcode + * And then in its hook_node_grants() implementation, it would need to return: + * @code + * if ($op == 'view') { + * $grants['example_realm'] = array(888); + * } + * @endcode + * If you decide to do this, be aware that the node_access_rebuild() function + * will erase any node ID 0 entry when it is called, so you will need to make + * sure to restore your {node_access} record after node_access_rebuild() is + * called. + * + * @see node_access_view_all_nodes() + * @see node_access_rebuild() + * * @param $account * The user object whose grants are requested. * @param $op |