function _services_oauth_controller_settings in Services 7.3
Same name and namespace in other branches
- 6.3 auth/services_oauth/services_oauth.inc \_services_oauth_controller_settings()
1 string reference to '_services_oauth_controller_settings'
- services_oauth_services_authentication_info in auth/
services_oauth/ services_oauth.module - Implementation of hook_services_authentication().
File
- auth/
services_oauth/ services_oauth.inc, line 159 - Include file for services_oauth module.
Code
function _services_oauth_controller_settings($settings, $controller, $endpoint, $class, $name) {
$form = array();
$cc = array(
'credentials' => '',
'authorization' => '',
);
if (!empty($controller['endpoint']['services_oauth'])) {
$cc = $controller['endpoint']['services_oauth'] + $cc;
}
$auth_levels = array();
if (is_array($endpoint) && isset($endpoint['oauth_context'])) {
$context = oauth_common_context_load($endpoint['oauth_context']);
if (isset($context->authorization_levels)) {
foreach ($context->authorization_levels as $name => $level) {
$auth_levels[$name] = t($level['title']);
}
}
}
$form['credentials'] = array(
'#type' => 'select',
'#options' => array(
'' => t('Default'),
'none' => t('None'),
'unsigned_consumer' => t('Unsigned with consumer key'),
'consumer' => t('Consumer key'),
'token' => t('Consumer key and access token'),
),
'#default_value' => isset($settings['credentials']) ? $settings['credentials'] : '',
'#title' => t('Required authentication'),
'#description' => t('Authorization levels will <em>not</em> be applied if the consumer isn\'t required to supply a access token.'),
);
$form['authorization'] = array(
'#type' => 'select',
'#options' => array(
'' => t('Default'),
) + $auth_levels,
'#default_value' => isset($settings['authorization']) ? $settings['authorization'] : '',
'#title' => t('Required authorization'),
);
return $form;
}