You are here

function oauth_common_form_authorization_submit in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.authorizations.inc \oauth_common_form_authorization_submit()
  2. 7.3 oauth_common.authorizations.inc \oauth_common_form_authorization_submit()

File

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

Code

function oauth_common_form_authorization_submit($form, $form_state) {
  global $user;
  $values = $form_state['values'];
  $token = $values['token_object'];
  $consumer = $token->consumer;

  // Collect the authorization levels
  if (isset($values['levels'])) {
    $token->services = array_keys(array_filter($values['levels']));
  }
  $token->authorized = $values['authorized'];
  $token
    ->write(TRUE);
  drupal_set_message(t('The @consumer token @token was updated.', array(
    '@consumer' => $consumer->name,
    '@token' => $token->key,
  )));
  drupal_goto(sprintf('user/%d/oauth/authorizations', $user->uid));
}