You are here

function private_permission in Private 7

Same name and namespace in other branches
  1. 7.2 private.module \private_permission()

Implements hook_permission().

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

./private.module, line 56
A tremendously simple access control module -- it allows users to mark individual nodes as private; users with 'access private content' perms can read these nodes, while others cannot.

Code

function private_permission() {
  return array(
    'mark content as private' => array(
      'title' => t('Mark content as private'),
      'description' => t('Make content only viewable by people with access to view private content'),
    ),
    'access private content' => array(
      'title' => t('Access private content'),
      'description' => t('Access any content marked as private'),
    ),
    'edit private content' => array(
      'title' => t('Edit private content'),
      'description' => t('Edit content marked as private'),
    ),
  );
}