instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.52k stars 2.45k forks source link

LTI 1.3 Variable Substitutions for Sections should not use a comma-separated string on the API response. #2075

Closed ismael-texidor closed 1 year ago

ismael-texidor commented 2 years ago

Summary:

Regarding release https://community.canvaslms.com/t5/Canvas-Change-Log/2022-API-Change-Log/ta-p/509738 https://canvas.beta.instructure.com/doc/api/file.tools_variable_substitutions.html the addition of Canvas.course.sectionIds on the LTI 1.3 names and roles service. We're getting the section names for the users just fine, but they are a comma-separated string.

This is creating issues when separating multiple sections because It's also possible for a section name to have a comma. Therefore, when we separate on commas and we have a section with a comma in it, we are unable to accurately separate the sections on our end.

"https://purl.imsglobal.org/spec/lti/claim/custom": {
                        "student_id": "GONZOSISID",
                        "section_names": "test section 1 ,Gradescope Testing Staging, CA Course 001",
                        "preferred_geography": "ca"
                    },

In the response above we would separate 3 different sections using the comma as the separator:

  1. test section 1
  2. Gradescope Testing Staging
  3. CA Course 001

We should only separate two as the names of the sections would be the following:

  1. test section 1
  2. Gradescope Testing Staging, CA Course 001

This is why a comma-separated value will not work in this case.

Steps to reproduce:

  1. Update the LTI 1.3 Dev Key to include Canvas.course.sectionIds
  2. Create a user with multiple sections and the section names should include a comma.
  3. Make Resource Link API Call to https://canvas.beta.instructure.com/doc/api/names_and_role.html API. You must include the rlid parameter.

Expected behavior: Instead of sending a comma-separated string on the API response, we should use a different structure to separate each section. Another solution would be to not allow users to create sections with commas.

Actual behavior: A comma-separated string that will not allow us to accurately separate sections when a user creates a section name with commas in it.

Additional notes:

ismael-texidor commented 1 year ago

This now sends an array with the sections