-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: grant course staff exam access tokens #359
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,6 +385,10 @@ def get_response(cls, exam, user): | |
elif exam.due_date is not None and timezone.now() >= exam.due_date: | ||
grant_access, response_status = True, status.HTTP_200_OK | ||
|
||
# If user is course staff, then grant them access | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what we want, but I think we should have this before line 369. On the frontend, access to the contents of the exam will always be granted to staff members. Because of this, they never see any exam functionality and will not be able to start an exam attempt. Therefore, we can short circuit early and give them access immediately if they are a staff member - no need to look at exam attempts. This makes the code easier to reason about. Does that match your understanding? |
||
elif user.has_course_staff_permission(exam.course_id): | ||
grant_access, response_status = True, status.HTTP_200_OK | ||
|
||
if grant_access: | ||
log.info('Creating exam access token') | ||
access_token = sign_token_for(user.lms_user_id, expiration_window, claims) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you agree with my suggestion below, please update the docstring and the test.