You are here

function party_user_permission in Party 8.2

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

Implements hook_permission()

In this case 'own' means attached to a Party the user is also attached to.

File

modules/party_user/party_user.module, line 97
Support for linking users to parties

Code

function party_user_permission() {
  $permissions = array(
    'view own party' => array(
      'title' => t('View own party'),
    ),
    'edit own party' => array(
      'title' => t('Edit own party'),
    ),
  );

  // Add permissions for each data set.
  foreach (party_get_data_set_info() as $data_set_name => $data_set) {
    $permissions['view own party attached ' . $data_set_name] = array(
      'title' => t('View own party attached %name', array(
        '%name' => $data_set['label'],
      )),
    );
    $permissions['edit own party attached ' . $data_set_name] = array(
      'title' => t('Edit own party attached %name', array(
        '%name' => $data_set['label'],
      )),
    );
    $permissions['detach own party attached ' . $data_set_name] = array(
      'title' => t('Remove own party attached %name', array(
        '%name' => $data_set['label'],
      )),
    );
    $permissions['attach own party ' . $data_set_name] = array(
      'title' => t('Add own party attached %name', array(
        '%name' => $data_set['label'],
      )),
    );
  }
  return $permissions;
}