Skip to content

Commit

Permalink
Map extra LTI1.1 <-> LTI1.3 parameters
Browse files Browse the repository at this point in the history
These were missing but are only needed now for configuring the "user
reference" field in some VitalSource integrations.
  • Loading branch information
marcospri committed Feb 9, 2024
1 parent 1931a74 commit f9ee2f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lms/models/lti_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def _apply_canvas_quirks(lti_params, request):
"deep_link_return_url",
],
),
(
"lis_person_sourcedid",
[f"{CLAIM_PREFIX}/lis", "person_sourcedid"],
),
(
"deep_linking_settings",
["https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings"],
Expand All @@ -173,6 +177,15 @@ def _apply_canvas_quirks(lti_params, request):
"resource_link_id",
[f"{CLAIM_PREFIX}/lti1p1", "resource_link_id"],
),
# LMS dependant variables that are not part of the "custom" claim
(
"org_defined_id",
[
"https://purl.imsglobal.org/spec/lti/claim/launch_presentation",
"http://www.brightspace.com",
"org_defined_id",
],
),
)


Expand Down
8 changes: 8 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def lti_v13_params():
"name": "FULL_NAME",
"given_name": "GIVEN_NAME",
"family_name": "FAMILY_NAME",
"https://purl.imsglobal.org/spec/lti/claim/lis": {
"person_sourcedid": "LIS_PERSON_SOURCEID"
},
"https://purl.imsglobal.org/spec/lti/claim/context": {
"id": "CONTEXT_ID",
"label": "LTI",
Expand All @@ -87,6 +90,11 @@ def lti_v13_params():
"canvas_course_id": 319,
"canvas_api_domain": "hypothesis.instructure.com",
},
"https://purl.imsglobal.org/spec/lti/claim/launch_presentation": {
"http://www.brightspace.com": {
"org_defined_id": "ORG_DEFINED_ID",
}
},
}


Expand Down
2 changes: 2 additions & 0 deletions tests/unit/lms/models/lti_params_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class TestLTIParams:
("lis_person_name_family", "FAMILY_NAME"),
("lis_person_name_full", "FULL_NAME"),
("lis_person_contact_email_primary", "EMAIL"),
("lis_person_sourcedid", "LIS_PERSON_SOURCEID"),
("context_id", "CONTEXT_ID"),
("context_title", "CONTEXT_TITLE"),
("lti_version", "LTI_VERSION"),
("lti_message_type", "LTI_MESSAGE_TYPE"),
("resource_link_id", "RESOURCE_LINK_ID"),
("resource_link_title", "RESOURCE_LINK_TITLE"),
("resource_link_description", "RESOURCE_LINK_DESCRIPTION"),
("org_defined_id", "ORG_DEFINED_ID"),
],
)
def test_v13_mappings(self, pyramid_request, lti_v13_params, lti_11_key, value):
Expand Down

0 comments on commit f9ee2f6

Please sign in to comment.