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

Prevent LTI Advantage external tool add failing due to uniqueness constraint and tag not persisting

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisite

      Note: This test is using 2 apps to test 1.3 and 1.1 interactions; any other LTI 1.3 Test application could be used instead. Steps should be rather identical, what matters is to be able to post 2 resources with the same resource id and a tag value, both under 1.1 and 1.3 flows.

      1. Site is configured with at least one course
      2. LTI Test tool 1.1 is installed as a site external tool:
        1. Log in as an administrator
        2. Navigate to Site Administration > Plugins > External tool > Manage tools
        3. Click on configure a tool manually
        4. Fill the form as follow:
          1. Tool name: LTI Test Tool
          2. Tool url: https://lti.tools/test/tp.php
        5. Consumer key: any value would do
        6. Shared secret: secret
        7. Click on ‘Show more’
        8. Check Content-Item message
        9. Change the 'Privacy' setting ‘Accept grades from the tool’ to 'Delegate to Teacher'.
        10. In Services, IMS LTI Assignment and Grade Services, choose Use this service for grade and column mgmt
        11. Save changes.
      3. ZTest tool 1.3 is installed as a site external tool:
        1. Log in as an administrator
        2. Navigate to Site Administration > Plugins > External tool > Manage tools
        3. Click on configure a tool manually
        4. Fill the form as follow:
          1. Tool name: ZTest 1.3
          2. Tool url: https://ztest.cengage.info/ztest
        5. LTI Version: LTI 1.3
        6. Public key: copy the value from https://ztest.cengage.info/ztest/ LTI 1.3 Connect info tab
        7. Initiate Login URI: https://ztest.cengage.info/ztest/ws/lti/startlaunch?lti13=true&client_id=CLIENT_ID_HERE&platform=moodle
        8. Redirect URI: https://ztest.cengage.info/ztest/lti13
        9. Click on ‘Show more’
        10. Check Content-Item message
        11. Change the 'Privacy' setting ‘Accept grades from the tool’ to 'Delegate to Teacher'.
        12. In Services, IMS LTI Assignment and Grade Services, choose Use this service for grade and column mgmt
        13. Save changes.
        14. Once the tool is created, click the information icon (pie icon) and copy the client id
        15. Update the initiate login URI and replace CLIENT_ID_HERE with the client id value for that tool

      Adding an LTI 1.1 Resource link with line item creates a graded activity and persists resource id and tag

      In this test we verify that when an app is configured to set or not a gradebook column on a per link bases, a gradebook column will always be enabled and populated only if the content item contains a gradebook column, and that the resource id and tag are persisted.

      1. As instructor, log to a course
      2. Turn editing ON
      3. Click Add an activity or resource and select external tool
      4. On the Add external tool page, select LTI Test tool for preconfigured tool
      5. Click on Select Content
      6. In the modal:
        1. Click content-item button
      7. Click on Select Content
      8. In the modal:
        1. Click content-item button
        2. Select LTI Launch 2 (it contains a gradebook definition)
        3. At the bottom of the page, click return selection
      9. When the modal is closed, verify:
        1. Grade section is visible
        2. Expand the grade section
        3. Maximum Score: 50
        4. Verify id-number has no value
        5. Save and return to course
        6. Launch the link
        7. In the raw parameters check custom_lineitem_url is present and populated
        8. Select outcomes 2 and line item, click action: read
        9. In the pop-up verify the JSON contains a property "resourceId" with a value of "a-...." (starts with a–), tag value is empty

      Adding an LTI 1.3 Resource link with line item creates a graded activity and persists resource id and tag

      In this test we verify that when an app is configured to set or not a gradebook column on a per link bases, a gradebook column will always be enabled and populated only if the content item contains a gradebook column, and that the resource id and tag are persisted.

      1. As instructor, log to a course
      2. Turn editing ON
      3. Click Add an activity or resource and select external tool
      4. On the Add external tool page, select ZTest 13 tool for preconfigured tool
      5. Click on Select Content
      6. In the modal:
        1. Click content-item button
      7. Click on Select Content
      8. In the modal:
        1. Click on pie icon and select content-item
        2. Enter for the resource id: MDL-65306-ZTest
        3. Select Assignment and set points possible to 50
        4. Click Submit button
      9. When the modal is closed, verify:
        1. Grade section is visible
        2. Expand the grade section
        3. Maximum Score: 50
        4. Verify id-number has no value
        5. Save and return to course
        6. Launch the ztest activity link just created
        7. In the parameters check custom_lineitem_url is present and populated
        8. Select Any call
        9. Click on Get line items and Send buttons
        10. In the Response, verify 200 and that there is one (and only one) item present with "resourceId": "MDL-65306-Ztest"
        11. The same json object should also have the property: "tag": "ztest-tag"

      Verify we can have more than one link with the same resource id and tag

      1. We now repeat the above operation (Adding an LTI 1.3 Resource link) exactly so as to create a duplicate
      2. Only change the final verification after Get Line Items in Ztest:
        1. In the Response, verify 200 and that there are 2 items present with "resourceId": "MDL-65306-Ztest"
        2. The same json object should also have the property: "tag": "ztest-tag"

      Verify previous release backup preserves resourceid

      In this test, we restore a course created on a 3.8 moodle instance which contains LTI links and gradebook columns created by ZTest. We verify the restored backup still contains the resourceid (since it is now stored on a new location).

      1. As admin, restore the attached course backup-moodle2-course-2-ztestcourse38-20200526-1227-nu.mbz
        1. Restore as new course
        2. Keep all default options
        3. Perform restore
      2. Once in the restored course
        1. Verify 2 ZTest links are present
        2. Click on any of those
        3. Verify ZTest opens without error
        4. Click AnyCall
        5. Click get lineitems button and click send button
        6. Verify payload matches the following JSON, just the id field should differ:

      [
        {
          "id": "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/29/lineitem?type_id=1",
          "label": "ZTest Quiz No Resource Id",
          "scoreMaximum": 20,
          "resourceId": "",
          "tag": "",
          "resourceLinkId": "23",
          "ltiLinkId": "23"
        },
        {
          "id": "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/30/lineitem?type_id=1",
          "label": "ZTest Quiz With ResourceId",
          "scoreMaximum": 20,
          "resourceId": "ztest-quiz-1",
          "tag": "",
          "resourceLinkId": "24",
          "ltiLinkId": "24"
        },
        {
          "id": "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/31/lineitem?type_id=1",
          "label": "API ZTest 748",
          "scoreMaximum": 22,
          "resourceId": "748",
          "tag": "finalgrade"
        }
      ]
      

      Show
      Prerequisite Note: This test is using 2 apps to test 1.3 and 1.1 interactions; any other LTI 1.3 Test application could be used instead. Steps should be rather identical, what matters is to be able to post 2 resources with the same resource id and a tag value, both under 1.1 and 1.3 flows. Site is configured with at least one course LTI Test tool 1.1 is installed as a site external tool: Log in as an administrator Navigate to Site Administration > Plugins > External tool > Manage tools Click on configure a tool manually Fill the form as follow: Tool name: LTI Test Tool Tool url: https://lti.tools/test/tp.php Consumer key: any value would do Shared secret: secret Click on ‘Show more’ Check Content-Item message Change the 'Privacy' setting ‘Accept grades from the tool’ to 'Delegate to Teacher'. In Services, IMS LTI Assignment and Grade Services, choose Use this service for grade and column mgmt Save changes. ZTest tool 1.3 is installed as a site external tool: Log in as an administrator Navigate to Site Administration > Plugins > External tool > Manage tools Click on configure a tool manually Fill the form as follow: Tool name: ZTest 1.3 Tool url: https://ztest.cengage.info/ztest LTI Version: LTI 1.3 Public key: copy the value from https://ztest.cengage.info/ztest/ LTI 1.3 Connect info tab Initiate Login URI: https://ztest.cengage.info/ztest/ws/lti/startlaunch?lti13=true&client_id=CLIENT_ID_HERE&platform=moodle Redirect URI: https://ztest.cengage.info/ztest/lti13 Click on ‘Show more’ Check Content-Item message Change the 'Privacy' setting ‘Accept grades from the tool’ to 'Delegate to Teacher'. In Services, IMS LTI Assignment and Grade Services, choose Use this service for grade and column mgmt Save changes. Once the tool is created, click the information icon (pie icon) and copy the client id Update the initiate login URI and replace CLIENT_ID_HERE with the client id value for that tool Adding an LTI 1.1 Resource link with line item creates a graded activity and persists resource id and tag In this test we verify that when an app is configured to set or not a gradebook column on a per link bases, a gradebook column will always be enabled and populated only if the content item contains a gradebook column, and that the resource id and tag are persisted. As instructor, log to a course Turn editing ON Click Add an activity or resource and select external tool On the Add external tool page, select LTI Test tool for preconfigured tool Click on Select Content In the modal: Click content-item button Click on Select Content In the modal: Click content-item button Select LTI Launch 2 (it contains a gradebook definition) At the bottom of the page, click return selection When the modal is closed, verify: Grade section is visible Expand the grade section Maximum Score: 50 Verify id-number has no value Save and return to course Launch the link In the raw parameters check custom_lineitem_url is present and populated Select outcomes 2 and line item, click action: read In the pop-up verify the JSON contains a property "resourceId" with a value of "a-...." (starts with a–), tag value is empty Adding an LTI 1.3 Resource link with line item creates a graded activity and persists resource id and tag In this test we verify that when an app is configured to set or not a gradebook column on a per link bases, a gradebook column will always be enabled and populated only if the content item contains a gradebook column, and that the resource id and tag are persisted. As instructor, log to a course Turn editing ON Click Add an activity or resource and select external tool On the Add external tool page, select ZTest 13 tool for preconfigured tool Click on Select Content In the modal: Click content-item button Click on Select Content In the modal: Click on pie icon and select content-item Enter for the resource id: MDL-65306 -ZTest Select Assignment and set points possible to 50 Click Submit button When the modal is closed, verify: Grade section is visible Expand the grade section Maximum Score: 50 Verify id-number has no value Save and return to course Launch the ztest activity link just created In the parameters check custom_lineitem_url is present and populated Select Any call Click on Get line items and Send buttons In the Response, verify 200 and that there is one (and only one) item present with "resourceId": " MDL-65306 -Ztest" The same json object should also have the property: "tag": "ztest-tag" Verify we can have more than one link with the same resource id and tag We now repeat the above operation (Adding an LTI 1.3 Resource link) exactly so as to create a duplicate Only change the final verification after Get Line Items in Ztest: In the Response, verify 200 and that there are 2 items present with "resourceId": " MDL-65306 -Ztest" The same json object should also have the property: "tag": "ztest-tag" Verify previous release backup preserves resourceid In this test, we restore a course created on a 3.8 moodle instance which contains LTI links and gradebook columns created by ZTest. We verify the restored backup still contains the resourceid (since it is now stored on a new location). As admin, restore the attached course backup-moodle2-course-2-ztestcourse38-20200526-1227-nu.mbz Restore as new course Keep all default options Perform restore Once in the restored course Verify 2 ZTest links are present Click on any of those Verify ZTest opens without error Click AnyCall Click get lineitems button and click send button Verify payload matches the following JSON, just the id field should differ: [ { "id" : "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/29/lineitem?type_id=1" , "label" : "ZTest Quiz No Resource Id" , "scoreMaximum" : 20 , "resourceId" : "" , "tag" : "" , "resourceLinkId" : "23" , "ltiLinkId" : "23" }, { "id" : "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/30/lineitem?type_id=1" , "label" : "ZTest Quiz With ResourceId" , "scoreMaximum" : 20 , "resourceId" : "ztest-quiz-1" , "tag" : "" , "resourceLinkId" : "24" , "ltiLinkId" : "24" }, { "id" : "https://moodle.zeedeeyou.com/mod/lti/services.php/4/lineitems/31/lineitem?type_id=1" , "label" : "API ZTest 748" , "scoreMaximum" : 22 , "resourceId" : "748" , "tag" : "finalgrade" } ]
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-65306-resourceid-onecommit

      Description

      Part of the LTI Advantage Assignment and Grade Services support, Moodle must retain for each grade item created for LTI the resource id and the tag as provided by the tool when the line item was created. Currently the resource id is stored using the grade item id number and tag is not persisted at all; as a consequence:

      1. The link may fail creation due to a uniqueness constraint on the id number field used to store the resource id
      2. The id number may be edited by the end user which would cause the tool to possibly malfunction
      3. tag information is not persisted, which is a requirement for LTI Advantage

      The proposed fix is:

      1. Add a new column in gbs table to store resource id and use it to store the resource id and tag
      2. Migrates existing id_number to gbs.resource_id
        1. This will require the addition of the missing gbs entries
      3. Modify the add activity flow to pass both the resource_id as hidden input to the back end and have the back end create the associated gbs entry

      The ticket covers the work needed for MDL-65305.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              claudevervoort Claude Vervoort
              Reporter:
              claudevervoort Claude Vervoort
              Peer reviewer:
              Mathew May
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jun/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 1 hour, 10 minutes
                  2d 1h 10m