some reset ansnwer improvements
This commit is contained in:
+6
-5
@@ -502,7 +502,10 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
# 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)
|
||||
if exam.open_access or user in exam.get_author_objects():
|
||||
# Remove open_access check for the momement
|
||||
#if exam.open_access or user in exam.get_author_objects():
|
||||
# return True
|
||||
if user in exam.get_author_objects():
|
||||
return True
|
||||
|
||||
if exam.authors_only:
|
||||
@@ -1046,10 +1049,8 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
if request.htmx:
|
||||
exam = get_object_or_404(self.Exam, pk=exam_id)
|
||||
|
||||
if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
# raise PermissionDenied
|
||||
if request.user not in exam.author.all():
|
||||
raise PermissionDenied
|
||||
if not self.check_user_edit_access(request.user, exam_id):
|
||||
raise PermissionDenied
|
||||
|
||||
## Delete all answers
|
||||
exam.cid_user_answers.all().delete()
|
||||
|
||||
Reference in New Issue
Block a user