From 6784ab53349ee59221d0db41a8cd84f9a5acd6e5 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Thu, 29 Feb 2024 11:49:11 +0800 Subject: [PATCH] MDL-80646 mod_lti: Enable key and secret configuration in legacy tools When restoring a manually configured tool to a different site, the key and secret are not being restored, which is an expected behaviour. However, legacy (pre-4.3) manually configured tools do not have the option to configure the key and secret, which makes these instances unusable. To make sure these tools will continue working after a backup and restore, we need to re-enable the key and secret fields in the legacy instance settings form. --- mod/lti/mod_form.php | 2 -- mod/lti/tests/behat/addtool.feature | 11 ++++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 7980ff49d7e..d8a42ddddec 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -299,8 +299,6 @@ class mod_lti_mod_form extends moodleform_mod { 'toolurl', 'securetoolurl', 'launchcontainer', - 'resourcekey', - 'password', 'instructorcustomparameters', 'icon', 'secureicon', diff --git a/mod/lti/tests/behat/addtool.feature b/mod/lti/tests/behat/addtool.feature index d6d8e88499e..e83ad1d9fd2 100644 --- a/mod/lti/tests/behat/addtool.feature +++ b/mod/lti/tests/behat/addtool.feature @@ -89,7 +89,8 @@ Feature: Add tools And the "id_showtitlelaunch" "checkbox" should be enabled And the "id_showdescriptionlaunch" "checkbox" should be enabled And the "Secure tool URL" "field" should be disabled - And the "Consumer key" "field" should be disabled + And the "Consumer key" "field" should be enabled + And the "Shared secret" "field" should be enabled And I click on "Reveal" "icon" And I should see "secret" And the "Custom parameters" "field" should be disabled @@ -104,6 +105,8 @@ Feature: Add tools And I set the following fields to these values: | Activity name | A manual tool name edited | | id_showdescription | 1 | + | Consumer key | key | + | Shared secret | secret | And I press "Save and return to course" And I am on the "A manual tool" "lti activity editing" page logged in as teacher1 And I follow "Show more..." @@ -112,7 +115,8 @@ Feature: Add tools And the following fields match these values: | Activity name | A manual tool name edited | | id_showdescription | 1 | - | Consumer key | 12345 | + | Consumer key | key | + | Shared secret | secret | | Icon URL | http://download.moodle.org/unittest/test.jpg | | Secure icon URL | https://download.moodle.org/unittest/test.jpg | | Tool URL | http://www.example.com/lti/provider.php | @@ -125,7 +129,8 @@ Feature: Add tools And the "id_showtitlelaunch" "checkbox" should be enabled And the "id_showdescriptionlaunch" "checkbox" should be enabled And the "Secure tool URL" "field" should be disabled - And the "Consumer key" "field" should be disabled + And the "Consumer key" "field" should be enabled + And the "Shared secret" "field" should be enabled And I click on "Reveal" "icon" And I should see "secret" And the "Custom parameters" "field" should be disabled