Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept: ACS scope handling #362

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lti_consumer/lti_1p3/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@

# LTI-NRPS Scopes
'https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly',

# ACS Scopes
# TODO: This isn't necessarily the best place for this.
'https://purl.imsglobal.org/spec/lti-ap/claim/acs',
]


Expand Down
21 changes: 21 additions & 0 deletions lti_consumer/lti_1p3/extensions/rest_framework/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,24 @@ def get_permission_scopes(self, request, view):
]

return scopes


class LtiProctoringAcsPermissions(LTIBasePermissions):
"""
LTI ACS Permissions.

This checks if the token included in the request
has the allowed scopes to perform ACS actions
(insert action examples here)

Link to relevant docs: (ims global docs url here)
"""

def get_permission_scopes(self, request, view):
"""
Return the LTI ACS scope.
There is only one: http://www.imsglobal.org/spec/proctoring/v1p0#h.ckrfa92a27mw
"""
return [
'https://purl.imsglobal.org/spec/lti-ap/claim/acs',
]
8 changes: 6 additions & 2 deletions lti_consumer/plugin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,15 @@ def start_proctoring_assessment_endpoint(request):
django_cache_timeout=timeout
)

LTI_1P3_PROCTORING_ASSESSMENT_STARTED.send(
lti_proctoring_response = LTI_1P3_PROCTORING_ASSESSMENT_STARTED.send(
sender=None,
attempt_number=proctoring_response["attempt_number"],
resource_link=proctoring_response["resource_link"],
user_id=request.user.id,
)

return JsonResponse(data={})
response_data = lti_proctoring_response[0][1]
# if we have more than one receiver, how hard would this code be to modify?
# Note: must abide by LTI rules. So have handler that warns "hey you're data's the wrong shape" if it is

return JsonResponse(data={response_data})