MDL-58220 oauth2: Provide template specific help links
E.g. separate pages for Microsoft / Google.
This commit is contained in:
@@ -50,9 +50,15 @@ class issuer extends persistent {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$mform = $this->_form;
|
||||
$endpoint = $this->get_persistent();
|
||||
$issuer = $this->get_persistent();
|
||||
|
||||
$mform->addElement('html', $OUTPUT->page_doc_link(get_string('issuersetup', 'tool_oauth2')));
|
||||
$docslink = optional_param('docslink', '', PARAM_ALPHAEXT);
|
||||
if ($docslink) {
|
||||
$name = s($issuer->get('name'));
|
||||
$mform->addElement('html', $OUTPUT->doc_link($docslink, get_string('issuersetuptype', 'tool_oauth2', $name)));
|
||||
} else {
|
||||
$mform->addElement('html', $OUTPUT->page_doc_link(get_string('issuersetup', 'tool_oauth2')));
|
||||
}
|
||||
|
||||
// Name.
|
||||
$mform->addElement('text', 'name', get_string('issuername', 'tool_oauth2'));
|
||||
@@ -119,10 +125,10 @@ class issuer extends persistent {
|
||||
$mform->addElement('hidden', 'action', 'edit');
|
||||
$mform->setType('action', PARAM_ALPHA);
|
||||
|
||||
$mform->addElement('hidden', 'enabled', $endpoint->get('enabled'));
|
||||
$mform->addElement('hidden', 'enabled', $issuer->get('enabled'));
|
||||
$mform->setType('enabled', PARAM_BOOL);
|
||||
|
||||
$mform->addElement('hidden', 'id', $endpoint->get('id'));
|
||||
$mform->addElement('hidden', 'id', $issuer->get('id'));
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(true, get_string('savechanges', 'tool_oauth2'));
|
||||
|
||||
@@ -89,9 +89,10 @@ if ($mform && $mform->is_cancelled()) {
|
||||
} else if ($action == 'edittemplate') {
|
||||
|
||||
$type = required_param('type', PARAM_ALPHA);
|
||||
$docs = required_param('docslink', PARAM_ALPHAEXT);
|
||||
require_sesskey();
|
||||
$issuer = core\oauth2\api::create_standard_issuer($type);
|
||||
$params = ['action' => 'edit', 'id' => $issuer->get('id')];
|
||||
$params = ['action' => 'edit', 'id' => $issuer->get('id'), 'docslink' => $docs];
|
||||
$editurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
|
||||
redirect($editurl, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
} else if ($action == 'enable') {
|
||||
@@ -156,13 +157,17 @@ if ($mform && $mform->is_cancelled()) {
|
||||
$issuers = core\oauth2\api::get_all_issuers();
|
||||
echo $renderer->issuers_table($issuers);
|
||||
|
||||
$params = ['action' => 'edittemplate', 'type' => 'google', 'sesskey' => sesskey()];
|
||||
$docs = 'admin/tool/oauth2/issuers/google';
|
||||
$params = ['action' => 'edittemplate', 'type' => 'google', 'sesskey' => sesskey(), 'docslink' => $docs];
|
||||
$addurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
|
||||
echo $renderer->single_button($addurl, get_string('createnewgoogleissuer', 'tool_oauth2'));
|
||||
$params = ['action' => 'edittemplate', 'type' => 'microsoft', 'sesskey' => sesskey()];
|
||||
$docs = 'admin/tool/oauth2/issuers/microsoft';
|
||||
$params = ['action' => 'edittemplate', 'type' => 'microsoft', 'sesskey' => sesskey(), 'docslink' => $docs];
|
||||
$addurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
|
||||
echo $renderer->single_button($addurl, get_string('createnewmicrosoftissuer', 'tool_oauth2'));
|
||||
$params = ['action' => 'edittemplate', 'type' => 'facebook', 'sesskey' => sesskey()];
|
||||
$docs = 'admin/tool/oauth2/issuers/facebook';
|
||||
$params = ['action' => 'edittemplate', 'type' => 'microsoft', 'sesskey' => sesskey(), 'docslink' => $docs];
|
||||
$params = ['action' => 'edittemplate', 'type' => 'facebook', 'sesskey' => sesskey(), 'docslink' => $docs];
|
||||
$addurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
|
||||
echo $renderer->single_button($addurl, get_string('createnewfacebookissuer', 'tool_oauth2'));
|
||||
$addurl = new moodle_url('/admin/tool/oauth2/issuers.php', ['action' => 'edit']);
|
||||
|
||||
@@ -54,6 +54,7 @@ $string['endpointsforissuer'] = 'Endpoints for issuer: {$a}';
|
||||
$string['endpointurl_help'] = 'URL for this endpoint. Must use https:// protocol.';
|
||||
$string['endpointurl'] = 'Url';
|
||||
$string['issuersetup'] = 'Detailed instructions on configuring the common OAuth 2 Services';
|
||||
$string['issuersetuptype'] = 'Detailed instructions on setting up the {$a} OAuth 2 provider';
|
||||
$string['issueralloweddomains_help'] = 'If set, this setting is a comma separated list of domains that logins will be restricted to when using this provider.';
|
||||
$string['issueralloweddomains_link'] = 'OAuth_2_login_domains';
|
||||
$string['issueralloweddomains'] = 'Login domains';
|
||||
@@ -87,7 +88,7 @@ $string['notdiscovered'] = 'Service discovery not successful';
|
||||
$string['notloginissuer'] = 'Do not allow login';
|
||||
$string['pluginname'] = 'OAuth 2 Services';
|
||||
$string['savechanges'] = 'Save changes';
|
||||
$string['serviceshelp'] = 'Service provider setup instructions: (Google, Facebook, Microsoft).';
|
||||
$string['serviceshelp'] = 'Service provider setup instructions.';
|
||||
$string['systemaccountconnected_help'] = 'System accounts are used to provide advanced functionality for plugins. They are not required for login functionality only, but other plugins using the OAuth service may offer a reduced set of features if the system account has not been connected. For example repositories cannot support "controlled links" without a system account to perform file operations.';
|
||||
$string['systemaccountconnected'] = 'System account connected';
|
||||
$string['systemaccountnotconnected'] = 'System account not connected';
|
||||
|
||||
Reference in New Issue
Block a user