You are here

function scald_permission in Scald: Media Management made easy 7

Implements hook_permission().

Actions are assigned to Drupal User Roles there.

File

./scald.module, line 1978
The Scald Core, which handles all Scald Registries and dispatch.

Code

function scald_permission() {
  $permissions = array(
    'administer scald' => array(
      'title' => t('Administer Scald'),
      'description' => t('Access Atom fields configuration and permissions'),
      'restrict access' => TRUE,
    ),
    'administer scald atoms' => array(
      'title' => t('Administer Scald Atoms'),
      'restrict access' => TRUE,
    ),
    'restrict atom access' => array(
      'title' => t('Restrict atom access'),
      'description' => t('User can restrict access to own atoms.'),
    ),
    'bypass atom access restrictions' => array(
      'title' => t('Bypass atom access restrictions'),
      'description' => t('Bypass the access restriction implemented by atom publisher.'),
      'restrict access' => TRUE,
    ),
    'create atom of any type' => array(
      'title' => t('Create atom of any type'),
    ),
  );

  // "Create" action for each types.
  foreach (scald_types() as $type) {
    $permissions['create atom of ' . $type->type . ' type'] = array(
      'title' => t('Create atom of %type type', array(
        '%type' => $type->type,
      )),
    );
  }

  // Other actions (Fetch, Edit, View, Delete, ....))
  foreach (scald_actions() as $key => $action) {
    $permissions[$key . ' own atom'] = array(
      'title' => t('%action own atom', array(
        '%action' => $action['title'],
      )),
    );
    $permissions[$key . ' any atom'] = array(
      'title' => t('%action any atom marked as %actionable', array(
        '%action' => $action['title'],
        '%actionable' => $action['adjective'],
      )),
    );
  }
  return $permissions;
}