Return content type gate for staff users when masquerading as the Learner in Audit or Learner in Limited Access Roles

This is necessary to display the content type gate in the UI
AA-613
This commit is contained in:
Matthew Piatetsky
2021-02-01 22:15:42 -05:00
parent 71b15df66c
commit ae7d0a1ed8
6 changed files with 117 additions and 91 deletions

View File

@@ -479,6 +479,13 @@ class SequenceMetadata(DeveloperErrorViewMixin, APIView):
except InvalidKeyError:
raise NotFound("Invalid usage key: '{}'.".format(usage_key_string))
_, request.user = setup_masquerade(
request,
usage_key.course_key,
staff_access=has_access(request.user, 'staff', usage_key.course_key),
reset_masquerade_data=True,
)
sequence, _ = get_module_by_usage_id(
self.request,
str(usage_key.course_key),