You are here

function oauth_common_permissions_form in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.authorizations.inc \oauth_common_permissions_form()
  2. 7.3 oauth_common.authorizations.inc \oauth_common_permissions_form()
1 call to oauth_common_permissions_form()
oauth_common_form_authorization in ./oauth_common.authorizations.inc

File

./oauth_common.authorizations.inc, line 157
Functions related to a user's authorization section

Code

function oauth_common_permissions_form($account, &$form, $consumer, $context, $default_services = array(
  '*',
)) {
  $tvars = array(
    '@appname' => $consumer->name,
    '@user' => $account->name,
    '@sitename' => variable_get('site_name', ''),
  );
  if ($context) {
    foreach ($context->authorization_levels as $name => $level) {
      $auth_opt = array(
        '#type' => 'checkbox',
        '#title' => t($level['title'], $tvars),
        '#description' => t($level['description'], $tvars),
        '#default_value' => in_array($name, $default_services),
      );
      $form['authorization']['levels'][$name] = $auth_opt;
    }
  }
}