You are here

function gallery_assist_permission in Gallery Assist 7

Implements hook_permission().

File

./gallery_assist.module, line 65
Extend drupal with gallery functionalities. Manage galleries.

Code

function gallery_assist_permission() {

  // Access permissions for the global configuration.
  $access = array(
    'administer gallery assist' => array(
      'title' => t('Administer GA'),
      'description' => t("Manage GA global settings and all galleries (su)."),
    ),
  );

  // Access permissions for content types with assigned gallery functionality.
  $access_holder = array();
  $types = node_type_get_names();
  foreach ($types as $type => $name) {
    if (variable_get("gallery_assist_{$type}") == 1) {
      $access_holder[] = array(
        "create {$type} galleries" => array(
          'title' => t("<strong>Create GA content on {$name}</strong>"),
        ),
        "view {$type} galleries" => array(
          'title' => t("View GA content on {$name}"),
        ),
        "edit own {$type} galleries" => array(
          'title' => t("Edit own GA content on {$name}"),
          'description' => t(""),
        ),
        "edit any {$type} galleries" => array(
          'title' => t("Edit any GA content on {$name}"),
        ),
        "delete own {$type} galleries" => array(
          'title' => t("Delete own GA content on {$name}"),
        ),
        "delete any {$type} galleries" => array(
          'title' => t("Delete any GA content on {$name}"),
        ),
      );
    }
  }
  for ($i = 0; $i < count($access_holder); ++$i) {
    $access = array_merge($access, $access_holder[$i]);
  }
  return $access;
}