Skip to content

Commit

Permalink
MDL-70722 core_badges: minor fixes from MDL-70689
Browse files Browse the repository at this point in the history
In MDL-70689, Eloy and Helen suggested some fixes to improve this patch.
As this is a followup issue to move the pending services, this
very first commit will fix pending things raised in the parent issue.
  • Loading branch information
sarjona committed Mar 26, 2021
1 parent d65ed58 commit 5d93de8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions admin/tool/oauth2/issuers.php
Expand Up @@ -53,7 +53,7 @@
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;
Expand Down Expand Up @@ -96,7 +96,7 @@
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();
Expand All @@ -115,7 +115,7 @@
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();
}
Expand All @@ -130,9 +130,9 @@
$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();

Expand Down Expand Up @@ -199,7 +199,7 @@
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';
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/oauth2/lang/en/tool_oauth2.php
Expand Up @@ -31,7 +31,7 @@
$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.';
Expand All @@ -53,7 +53,7 @@
$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.';
Expand Down
20 changes: 10 additions & 10 deletions admin/tool/oauth2/tests/behat/basic_settings.feature
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/oauth2/issuer.php
Expand Up @@ -111,7 +111,7 @@ protected static function define_properties() {
'default' => true
),
'servicetype' => array(
'type' => PARAM_TEXT,
'type' => PARAM_ALPHANUM,
'null' => NULL_ALLOWED,
'default' => null,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/oauth2/service/imsobv2p1.php
Expand Up @@ -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',
];
Expand Down

0 comments on commit 5d93de8

Please sign in to comment.