You are here

function oauth_common_permission in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 7.4 oauth_common.module \oauth_common_permission()

Implements hook_permission().

File

./oauth_common.module, line 20

Code

function oauth_common_permission() {
  $permissions = array(
    'access own authorizations' => array(
      'title' => t('Access own OAuth authorizations'),
      'restrict access' => TRUE,
    ),
    'access own consumers' => array(
      'title' => t('Access own OAuth consumers'),
      'restrict access' => TRUE,
    ),
    'oauth authorize any consumers' => array(
      'title' => t('Authorize any OAuth consumers'),
      'restrict access' => TRUE,
    ),
    'oauth register any consumers' => array(
      'title' => t('Register any OAuth consumers'),
      'restrict access' => TRUE,
    ),
    'administer oauth' => array(
      'title' => t('Administer OAuth'),
      'restrict access' => TRUE,
    ),
    'administer consumers' => array(
      'title' => t('Administer OAuth consumers'),
      'restrict access' => TRUE,
    ),
  );

  // Add seperate permissions for creating and
  // authorizing consumers in each context.
  foreach (oauth_common_context_list() as $name => $title) {
    $permissions[sprintf('oauth register consumers in %s', $name)] = array(
      'title' => t('Register OAuth consumers in %context', array(
        '%context' => $title,
      )),
    );
    $permissions[sprintf('oauth authorize consumers in %s', $name)] = array(
      'title' => t('Authorize OAuth consumers in %context', array(
        '%context' => $title,
      )),
    );
  }
  return $permissions;
}