You are here

function subuser_permission in Subuser 8

Same name and namespace in other branches
  1. 7.2 subuser.module \subuser_permission()

Implements hook_permission().

File

./subuser.module, line 12
Provides primary Drupal hook implementations.

Code

function subuser_permission() {
  $permissions = array(
    'administer subusers' => array(
      'title' => t('Administer subusers'),
      'description' => t('Allows a user to administer subusers.'),
    ),
    'view subusers' => array(
      'title' => t('View subusers'),
      'description' => t('Allows a user to view subusers.'),
    ),
    'edit subusers' => array(
      'title' => t('Edit subusers'),
      'description' => t('Allows a user to edit subusers.'),
    ),
    'delete subusers' => array(
      'title' => t('Delete subusers'),
      'description' => t('Allows a user to delete subusers.'),
    ),
    'override subuser relation' => array(
      'title' => t('Override relation'),
      'description' => t('Override the default for subuser_relation field which determines if a relation should be stored.'),
    ),
  );

  // Provide a create subuser permission for each role.
  foreach (user_roles(TRUE) as $rid => $role) {
    $permissions['create subuser ' . $rid] = array(
      'title' => t('Create an %role', array(
        '%role' => $role,
      )),
    );
  }
  return $permissions;
}