You are here

function environment_indicator_permission in Environment Indicator 7.2

Same name and namespace in other branches
  1. 8.2 environment_indicator.module \environment_indicator_permission()
  2. 7 environment_indicator.module \environment_indicator_permission()

Implements hook_permission().

File

./environment_indicator.module, line 55
Module implementation file.

Code

function environment_indicator_permission() {
  $permissons = array(
    'administer environment indicator settings' => array(
      'title' => t('Administer environment_indicator settings'),
      'description' => t('Configure the environments and the colors to display.'),
    ),
    'access environment indicator' => array(
      'title' => t('See environment indicator'),
      'description' => t('See all the environment indicators in the site.'),
    ),
  );
  $environments = environment_indicator_get_all();
  foreach ($environments as $machine => $environment) {
    $permissons['access environment indicator ' . $environment->machine] = array(
      'title' => t('See environment indicator for %name', array(
        '%name' => $environment->name,
      )),
      'description' => t('See the environment indicator if the user is in the %name environment.', array(
        '%name' => $environment->name,
      )),
    );
  }

  // Manually add the overwritten environment.
  $permissons['access environment indicator overwritten_environment'] = array(
    'title' => t('See environment indicator for the overwritten environment'),
    'description' => t('See the environment indicator if the user is in the environment defined in settings.php.'),
  );
  return $permissons;
}