When masquerading in courseware API, reset the request user

It's important that request.user be set as the effective user,
because waffle flags and bits of code around the place look at it.

This should make masquerading more accurate to what the learner
sees.
This commit is contained in:
Michael Terry
2020-11-13 12:58:18 -05:00
parent 2cf023bf27
commit 7697b7dd46

View File

@@ -72,6 +72,7 @@ class CoursewareMeta:
course_key,
staff_access=self.original_user_is_staff,
)
self.request.user = self.effective_user
self.is_staff = has_access(self.effective_user, 'staff', self.overview).has_access
self.enrollment_object = CourseEnrollment.get_enrollment(self.effective_user, self.course_key,
select_related=['celebration'])