You are here

function oauth_grant_access in OAuth 1.0 6

Form callback for granting access to the consumer

1 string reference to 'oauth_grant_access'
oauth_auth_token in ./oauth.module
Authorize a request token.

File

./oauth.module, line 209

Code

function oauth_grant_access() {
  module_invoke('services');
  $services = services_get_all();

  #todo tripple check image reference.
  $form['oauth_callback'] = array(
    '#type' => 'hidden',
    '#value' => $_GET['oauth_callback'],
  );
  $form['oauth_token'] = array(
    '#type' => 'hidden',
    '#value' => $_GET['oauth_token'],
  );
  $form['oauth_consumer_key'] = array(
    '#type' => 'hidden',
    '#value' => $_GET['oauth_consumer_key'],
  );
  $form['oauth_nonce'] = array(
    '#type' => 'hidden',
    '#value' => $_GET['oauth_nonce'],
  );
  $form['oauth_nonce_timestamp'] = array(
    '#type' => 'hidden',
    '#value' => $_GET['oauth_timestamp'],
  );
  $form['services'] = array(
    '#title' => t('Select services'),
    '#type' => 'fieldset',
  );
  foreach ($services as $service) {
    $method_name = $service['#method'];
    $form['services'][$method_name] = array(
      '#title' => $service['#method'],
      '#type' => 'radios',
      '#options' => array(
        0 => t('access'),
        1 => t('block'),
      ),
      '#default_value' => 1,
    );
  }
  $form['confirm'] = array(
    '#type' => 'submit',
    '#value' => t('Grant access'),
    '#weight' => 10,
  );
  $form['#tree'] = TRUE;
  return $form;
}