Same name and namespace in other branches
  1. 4.6.x developer/examples/node_access_example.module \node_access_example_perm()
  2. 4.7.x developer/examples/node_access_example.module \node_access_example_perm()

Implementation of hook_perm().

In this example, we will use a simple permission to determine whether a user has access to "private" content. This permission is defined here.

File

developer/examples/node_access_example.module, line 55
This is an example illustrating how to restrict access to nodes based on some criterion associated with the user.

Code

function node_access_example_perm() {
  return array(
    'access private content',
    'edit private content',
  );
}