Skip to content

Commit e873173

Browse files
committed
✨(backend) allow IMS LIS LTI roles
When parsing LTI role string from requests, we want to handle IMS LIS format.
1 parent 09bb96f commit e873173

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
### Added
12+
13+
- Support for the IMS LIS role format in the LTI launch
14+
1115
## [5.5.1] - 2024-11-29
1216

1317
### Fixed

src/backend/marsha/core/lti/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ def roles(self):
264264
265265
"""
266266
roles = self.request.POST.get("roles", "")
267+
# remove LIS roles prefix
268+
roles = re.sub(r"^urn:lti:instrole:ims/lis/", "", roles)
267269
# Remove all spaces from the string and extra trailing or leading commas
268270
roles = re.sub(r"[\s+]", "", roles).strip(",")
269271
# Return a set of the roles mentioned in the request

src/backend/marsha/core/tests/lti/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_lti_video_instructor(self):
9696
"student, Instructor", # a space after the comma is allowed
9797
", staff", # a leading comma should be ignored
9898
"staff,", # a trailing comma should be ignored
99+
"urn:lti:instrole:ims/lis/Instructor", # the LIS role identifier should be recognized
99100
]:
100101
request = self.factory.post("/", {"roles": roles_string})
101102
lti = LTI(request, uuid.uuid4())

0 commit comments

Comments
 (0)