diff --git a/admin/tool/oauth2/issuers.php b/admin/tool/oauth2/issuers.php index cc5da40997d..6383ef2c46b 100644 --- a/admin/tool/oauth2/issuers.php +++ b/admin/tool/oauth2/issuers.php @@ -53,7 +53,7 @@ if ($action == 'edit') { if ($issuer) { $PAGE->navbar->add(get_string('editissuer', 'tool_oauth2', s($issuer->get('name')))); } else { - $PAGE->navbar->add(get_string('createnewservice', 'tool_oauth2') . get_string('custom_service', 'tool_oauth2')); + $PAGE->navbar->add(get_string('createnewservice', 'tool_oauth2') . ' ' . get_string('custom_service', 'tool_oauth2')); } $showrequireconfirm = false; @@ -96,7 +96,7 @@ if ($mform && $mform->is_cancelled()) { if ($issuer) { echo $OUTPUT->heading(get_string('editissuer', 'tool_oauth2', s($issuer->get('name')))); } else { - echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . get_string('custom_service', 'tool_oauth2')); + echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . ' ' . get_string('custom_service', 'tool_oauth2')); } $mform->display(); echo $OUTPUT->footer(); @@ -115,7 +115,7 @@ if ($mform && $mform->is_cancelled()) { redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS); } else { echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . get_string($type . '_service', 'tool_oauth2')); + echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . ' ' . get_string($type . '_service', 'tool_oauth2')); $mform->display(); echo $OUTPUT->footer(); } @@ -130,9 +130,9 @@ if ($mform && $mform->is_cancelled()) { $mform = new \tool_oauth2\form\issuer(null, ['persistent' => $issuer, 'type' => $type, 'showrequireconfirm' => $showrequireconfirm]); - $PAGE->navbar->add(get_string('createnewservice', 'tool_oauth2') . get_string($type . '_service', 'tool_oauth2')); + $PAGE->navbar->add(get_string('createnewservice', 'tool_oauth2') . ' ' . get_string($type . '_service', 'tool_oauth2')); echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . get_string($type . '_service', 'tool_oauth2')); + echo $OUTPUT->heading(get_string('createnewservice', 'tool_oauth2') . ' ' . get_string($type . '_service', 'tool_oauth2')); $mform->display(); echo $OUTPUT->footer(); @@ -199,7 +199,7 @@ if ($mform && $mform->is_cancelled()) { echo $renderer->issuers_table($issuers); echo $renderer->container_start(); - echo get_string('createnewservice', 'tool_oauth2'); + echo get_string('createnewservice', 'tool_oauth2') . ' '; // Google template. $docs = 'admin/tool/oauth2/issuers/google'; diff --git a/admin/tool/oauth2/lang/en/tool_oauth2.php b/admin/tool/oauth2/lang/en/tool_oauth2.php index 938c576bcba..9ff13af03a4 100644 --- a/admin/tool/oauth2/lang/en/tool_oauth2.php +++ b/admin/tool/oauth2/lang/en/tool_oauth2.php @@ -31,7 +31,7 @@ $string['connectsystemaccount'] = 'Connect to a system account'; $string['createfromtemplate'] = 'Create an OAuth 2 service from a template'; $string['createfromtemplatedesc'] = 'Choose one of the OAuth 2 service templates below to create an OAuth service with a valid configuration for one of the known service types. This will create the OAuth 2 service, with all the correct end points and parameters required for authentication, though you will still need to enter the client ID and secret for the new service before it can be used.'; $string['createnewendpoint'] = 'Create new endpoint for issuer "{$a}"'; -$string['createnewservice'] = 'Create new service: '; +$string['createnewservice'] = 'Create new service:'; $string['createnewuserfieldmapping'] = 'Create new user field mapping for issuer "{$a}"'; $string['custom_service'] = 'Custom'; $string['deleteconfirm'] = 'Are you sure you want to delete the identity issuer "{$a}"? Any plugins relying on this issuer will stop working.'; @@ -53,7 +53,7 @@ $string['endpointurl_help'] = 'URL for this endpoint. Must use https:// protocol $string['endpointurl'] = 'URL'; $string['facebook_service'] = 'Facebook'; $string['google_service'] = 'Google'; -$string['imsobv2p1_service'] = 'IMS OBv2.1'; +$string['imsobv2p1_service'] = 'OpenBadges'; $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.'; diff --git a/admin/tool/oauth2/tests/behat/basic_settings.feature b/admin/tool/oauth2/tests/behat/basic_settings.feature index 2eb33451ac6..429d3713e1b 100644 --- a/admin/tool/oauth2/tests/behat/basic_settings.feature +++ b/admin/tool/oauth2/tests/behat/basic_settings.feature @@ -142,29 +142,29 @@ Feature: Basic OAuth2 functionality And I should see "Identity issuer deleted" And I should not see "Testing service modified" - Scenario: Create, edit and delete standard service for IMS OBv2.1 - Given I press "IMS OBv2.1" - And I should see "Create new service: IMS OBv2.1" + Scenario: Create, edit and delete standard service for OpenBadges + Given I press "OpenBadges" + And I should see "Create new service: OpenBadges" And I set the following fields to these values: | Client ID | thisistheclientid | | Client secret | supersecret | | Service base URL | https://dc.imsglobal.org/ | When I press "Save changes" Then I should see "Changes saved" - And I should see "IMS OBv2.1" - And "Configured" "icon" should exist in the "IMS OBv2.1" "table_row" - And "Do not allow login" "icon" should exist in the "IMS OBv2.1" "table_row" - And "Service discovery successful" "icon" should exist in the "IMS OBv2.1" "table_row" + And I should see "OpenBadges" + And "Configured" "icon" should exist in the "OpenBadges" "table_row" + And "Do not allow login" "icon" should exist in the "OpenBadges" "table_row" + And "Service discovery successful" "icon" should exist in the "OpenBadges" "table_row" And the "src" attribute of "table.admintable th img" "css_element" should contain "IMS-Global-Logo.png" - And I click on "Configure endpoints" "link" in the "IMS OBv2.1" "table_row" + And I click on "Configure endpoints" "link" in the "OpenBadges" "table_row" And I should see "https://dc.imsglobal.org/.well-known/badgeconnect.json" in the "discovery_endpoint" "table_row" And I should see "authorization_endpoint" And I follow "OAuth 2 services" - And I click on "Configure user field mappings" "link" in the "IMS OBv2.1" "table_row" + And I click on "Configure user field mappings" "link" in the "OpenBadges" "table_row" And I should not see "given_name" And I should not see "middle_name" And I follow "OAuth 2 services" - And I click on "Edit" "link" in the "IMS OBv2.1" "table_row" + And I click on "Edit" "link" in the "OpenBadges" "table_row" And I set the following fields to these values: | Name | IMS Global | And I press "Save changes" diff --git a/lib/classes/oauth2/issuer.php b/lib/classes/oauth2/issuer.php index b7545752ce2..ce4d32f384b 100644 --- a/lib/classes/oauth2/issuer.php +++ b/lib/classes/oauth2/issuer.php @@ -111,7 +111,7 @@ class issuer extends persistent { 'default' => true ), 'servicetype' => array( - 'type' => PARAM_TEXT, + 'type' => PARAM_ALPHANUM, 'null' => NULL_ALLOWED, 'default' => null, ), diff --git a/lib/classes/oauth2/service/imsobv2p1.php b/lib/classes/oauth2/service/imsobv2p1.php index 1edd552aef5..80adb3a55c1 100644 --- a/lib/classes/oauth2/service/imsobv2p1.php +++ b/lib/classes/oauth2/service/imsobv2p1.php @@ -35,7 +35,7 @@ class imsobv2p1 extends imsbadgeconnect implements issuer_interface { */ public static function init(): ?issuer { $record = (object) [ - 'name' => 'IMS OBv2.1', + 'name' => 'OpenBadges', 'image' => '', 'servicetype' => 'imsobv2p1', ];