You are here

function party_activity_permission in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_activity/party_activity.module \party_activity_permission()

Implements hook_permission().

File

modules/party_activity/party_activity.module, line 82
Functions and important hooks for the party_activity module

Code

function party_activity_permission() {
  $permissions = array(
    'administer activity types' => array(
      'title' => t('Administer Activity types'),
      'description' => t('Create and delete fields for activity types, and set there permissions'),
    ),
    'administer activities' => array(
      'title' => t('Administer Activities'),
      'description' => t('Edit and delete all activities'),
    ),
  );

  // General permissions per activity type
  foreach (party_activity_get_types() as $type) {
    $type_name = check_plain($type->type);
    $permissions += array(
      "edit any {$type_name} activity" => array(
        'title' => t('%type_name: Edit any activity', array(
          '%type_name' => $type->label,
        )),
      ),
      "view any {$type_name} activity" => array(
        'title' => t('%type_name: View any activity', array(
          '%type_name' => $type->label,
        )),
      ),
    );
  }
  return $permissions;
}