Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84827

Update mod_lti instance creation to manage resource links

XMLWordPrintable

    • MOODLE_500_STABLE
    • Hide

      Automated tests:

      mod/lti/tests/lib_test.php tests continue to pass

      Manual tests:

      Setup preamble:
      1. Required: Access to the database that the site is installed on
        1. Have the "lti_resource_link" table open and ensure it is empty if it is a fresh install
      2. Create two Moodle sites running on localhost - one designated 'platform', one 'tool'.
      3. In both sites, go to admin settings and clear all values from the 'curlsecurityblockedhosts' admin setting and save.
      4. In the platform site, create a course called "Platform course" and enrol a teacher.
      5. In the tool site, create a course called "Tool course", with:
        • An assignment called "Assign 1" with a max grade of 80.
        • An assignment called "Assign 2" with default settings.
        • A file resource (representing a non-graded activity).
        • A teacher enrolled.
      6. In the tool site admin settings:
        • Enable enrol_lti and auth_lti plugins.
        • Enable "Allow frame embedding".
      7. On the tool site, go to Admin > Plugins > Enrolments > Publish as LTI tool > Tool registration.
      8. Click ‘Register a platform’, enter a name for the platform and click "Continue".
      9. Once the platform is registered, keep this page with the registration details open, we'll need it shortly.
      10. On the platform site, go to 'Admin > General > LTI > Manage tools'.
      11. In the ‘Add tool’ section, paste the dynamic registration URL from the registration details on the tool site and click ‘Add LTI Advantage’.
      12. Once the tool is created click on ‘Activate’.
      13. Now, go to the ‘Platform course’ course and select ‘LTI external tools’ from the secondary navigation.
      14. Enable ‘Show in activity chooser’ for the tool.
      Adding a new LTI module instance:
      1. Log out of both the platform and tool sites completely.
      2. In the platform site, login at the teacher.
      3. Go to the "Platform course" course.
      4. Click to add a new activity, selecting the Tool.
      5. When the edit page loads, click the "Select content" button.
      6. Proceed to link your account by clicking the "Link this account" button.
      7. Go to the tool site's course 'Tool course'.
      8. From the menu, select "Published as LTI Tools"
      9. In the "LTI Advantage" tab, click "Add".
      10. Enter the following values:
        • Set "Tool to be published" to "Assign 1".
        • Save.
      11. Repeat steps 9-10 and publish ‘Assign 2’ and the file resource.
      12. Now, go back to the platform site and again, click "Select content".
      13. Click "Select content" again.
      14. Make sure both checkboxes for "Assign 1" are checked this time
      15. Click “Add content”.
      16. Click "Save and return to course"
      17. Verify that the “Assign 1” activity has been successfully added In the “Platform course” course
      18. Verify that the "lti_resource_link" database table now has a record in it containing data from the new LTI instance
      Updating an existing LTI module instance:
      1. After confirming the previous test, navigate back to the new LTI instance settings page in the platform site
      2. Change the activity name to a new testing value
      3. Press the "Save and return to course" button
      4. Verify that the "lti_resource_link" record created in the previous test now has an updated value within the "title" field
      Delete a specified LTI module instance:
      1. After confirming the previous test, delete the updated mod_lti instance
      2. Verify that the "lti_resource_link" record updated in the previous test has been removed
      Show
      Automated tests: mod/lti/tests/lib_test.php tests continue to pass Manual tests: Setup preamble: Required: Access to the database that the site is installed on Have the "lti_resource_link" table open and ensure it is empty if it is a fresh install Create two Moodle sites running on localhost - one designated 'platform', one 'tool'. In both sites, go to admin settings and clear all values from the 'curlsecurityblockedhosts' admin setting and save. In the platform site, create a course called "Platform course" and enrol a teacher. In the tool site, create a course called "Tool course", with: An assignment called "Assign 1" with a max grade of 80. An assignment called "Assign 2" with default settings. A file resource (representing a non-graded activity). A teacher enrolled. In the tool site admin settings: Enable enrol_lti and auth_lti plugins. Enable "Allow frame embedding". On the tool site, go to Admin > Plugins > Enrolments > Publish as LTI tool > Tool registration. Click ‘Register a platform’, enter a name for the platform and click "Continue". Once the platform is registered, keep this page with the registration details open, we'll need it shortly. On the platform site, go to 'Admin > General > LTI > Manage tools'. In the ‘Add tool’ section, paste the dynamic registration URL from the registration details on the tool site and click ‘Add LTI Advantage’. Once the tool is created click on ‘Activate’. Now, go to the ‘Platform course’ course and select ‘LTI external tools’ from the secondary navigation. Enable ‘Show in activity chooser’ for the tool. Adding a new LTI module instance: Log out of both the platform and tool sites completely. In the platform site, login at the teacher. Go to the "Platform course" course. Click to add a new activity, selecting the Tool. When the edit page loads, click the "Select content" button. Proceed to link your account by clicking the "Link this account" button. Go to the tool site's course 'Tool course'. From the menu, select "Published as LTI Tools" In the "LTI Advantage" tab, click "Add". Enter the following values: Set "Tool to be published" to "Assign 1". Save. Repeat steps 9-10 and publish ‘Assign 2’ and the file resource. Now, go back to the platform site and again, click "Select content". Click "Select content" again. Make sure both checkboxes for "Assign 1" are checked this time Click “Add content”. Click "Save and return to course" Verify that the “Assign 1” activity has been successfully added In the “Platform course” course Verify that the "lti_resource_link" database table now has a record in it containing data from the new LTI instance Updating an existing LTI module instance: After confirming the previous test, navigate back to the new LTI instance settings page in the platform site Change the activity name to a new testing value Press the "Save and return to course" button Verify that the "lti_resource_link" record created in the previous test now has an updated value within the "title" field Delete a specified LTI module instance: After confirming the previous test, delete the updated mod_lti instance Verify that the "lti_resource_link" record updated in the previous test has been removed
    • Hide

      Fails against automated checks.

      Checked MDL-84827 using repository: https://github.com/Chocolate-lightning/moodle.git

      • main [branch: MDL-84827 | CI Job]
        • Warn: The MDL-84827 branch at https://github.com/Chocolate-lightning/moodle.git has not been rebased recently (>20 days ago).
        • Error: The MDL-84827 branch at https://github.com/Chocolate-lightning/moodle.git does not apply clean to origin/main
        • Error: Merge conflict(s) in file(s):
        • Error: course/lib.php
        • Error: course/tests/externallib_test.php
        • Error: lib/classes/navigation/views/secondary.php
        • Error: lib/db/upgrade.php
        • Error: lib/navigationlib.php
        • Error: mod/lti/lang/en/lti.php
        • Error: mod/lti/locallib.php
        • Error: theme/boost/scss/moodle.scss
        • Error: theme/boost/style/moodle.css
        • Error: theme/classic/style/moodle.css
        • Error: version.php

      Should these errors be fixed?

      Built on: Fri Mar 28 05:55:35 UTC 2025

      Show
      Fails against automated checks. Checked MDL-84827 using repository: https://github.com/Chocolate-lightning/moodle.git main [branch: MDL-84827 | CI Job ] Warn: The MDL-84827 branch at https://github.com/Chocolate-lightning/moodle.git has not been rebased recently (>20 days ago). Error: The MDL-84827 branch at https://github.com/Chocolate-lightning/moodle.git does not apply clean to origin/main Error: Merge conflict(s) in file(s): Error: course/lib.php Error: course/tests/externallib_test.php Error: lib/classes/navigation/views/secondary.php Error: lib/db/upgrade.php Error: lib/navigationlib.php Error: mod/lti/lang/en/lti.php Error: mod/lti/locallib.php Error: theme/boost/scss/moodle.scss Error: theme/boost/style/moodle.css Error: theme/classic/style/moodle.css Error: version.php Should these errors be fixed? Built on: Fri Mar 28 05:55:35 UTC 2025
    • 5
    • Team Alpha - Sprint 3 I1-2025, Team Alpha - Sprint 4 I1-2025, Team Alpha - Planning I2-2025

      MDL-79109 now includes lti_resource_link (and a persistent). Now, instead of link data being included inside the lti record, we've pulled it out and store it in core_ltix. Links should be created by providing (among other things) {'component', ''itemtype', 'itemid', 'contextid'}, which uniquely identify the link for a given component, meaning the component can fetch the links later.

      This issue is scoped with:

      1. Creating/updating the resource link in core_ltix at the point where we're saving the mod_lti instance. See lti_add_instance() and lti_update_instance().
      2. Deleting the links on mod instance deletion, see lti_delete_instance().

      In terms of the unique identifiers to use, we should use:
      'itemtype': use 'mod_lti:activityplacement' string (the same string in mod/lti/db/lti.php - the placement type)
      'itemid': use the cmid of the instance (available as $lti->coursemodule in the above add/update methods, I believe).
      This ensures we can find the link later, when we want to launch it.

      Links can be created with or without deep linking, so we need to make sure that's tested. Also, we should test the "create multiple links via a single deep linking" scenario, if possible, just to make sure that's covered.

            mathewmay Glyn (Mathew) May
            jaked Jake Dallimore
            Mihail Geshoski Mihail Geshoski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days
                3d

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.