1 node_access_example.module node_access_example_permission()

Implements hook_permission().

We create two permissions, which we can use as a base for our grant/deny decision:

  • 'access any private content' allows global access to content marked private by other users.
  • 'edit any private content' allows global edit privileges, basically overriding the node access system.

Note that the 'edit any * content' and 'delete any * content' permissions will allow edit or delete permissions to the holder, regardless of what this module does.

See also

hook_permissions()

Related topics

File

modules/examples/node_access_example/node_access_example.module, line 189
Module file illustrating API-based node access.

Code

function node_access_example_permission() {
  return array(
    'access any private content' => array(
      'title' => t('Access any private content'),
      'description' => t('May view posts of other users even though they are marked private.'),
    ),
    'edit any private content' => array(
      'title' => t('Edit any private content'),
      'description' => t('May edit posts of other users even though they are marked private.'),
    ),
  );
}