This commit is contained in:
Ross
2022-05-03 19:00:15 +01:00
parent a6809f33e9
commit f0c779391d
+6
View File
@@ -294,6 +294,9 @@ class ExamViews(View, LoginRequiredMixin):
[boolean]: True if the user has access
"""
print("****", user, exam_id)
if user.is_superuser:
return True
if exam_id is not None:
exam = get_object_or_404(self.Exam, pk=exam_id)
if (exam.open_access and exam.active) or user in exam.get_author_objects():
@@ -347,6 +350,9 @@ class ExamViews(View, LoginRequiredMixin):
Returns:
[boolean]: True if the user has access
"""
if user.is_superuser:
return True
# If a user is an exam author they should have acccess
if exam_id is not None:
exam = get_object_or_404(self.Exam, pk=exam_id)