You are here

function organigrams_permission in Organigrams 7

Implements hook_permission().

File

./organigrams.module, line 864
Defines the organigrams functions and entity types.

Code

function organigrams_permission() {

  // Administer organigrams permission.
  $permissions = array(
    'administer organigrams' => array(
      'title' => t('Administer organigrams and items'),
    ),
  );

  // Iterate through the organigrams.
  foreach (organigrams_get_names() as $machine_name => $organigrams_info) {

    // Create the translation arguments.
    $t_args = array(
      '%organigram' => $organigrams_info->name,
    );

    // Add the edit and delete permission.
    $permissions['edit organigram ' . $machine_name] = array(
      'title' => t('Edit organigram and items in %organigram', $t_args),
    );
    $permissions['delete organigram ' . $machine_name] = array(
      'title' => t('Delete organigram items from %organigram', $t_args),
    );
  }

  // Return all permissions.
  return $permissions;
}