.
This commit is contained in:
+13
-5
@@ -328,6 +328,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
and not user.groups.filter(name="sba_checker").exists()
|
||||
):
|
||||
return False
|
||||
if (
|
||||
self.app_name == "casecollection"
|
||||
and not user.groups.filter(name="casecollection_checker").exists()
|
||||
):
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_user_edit_access(self, user, exam_id=None):
|
||||
@@ -370,6 +375,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
and not user.groups.filter(name="sba_checker").exists()
|
||||
):
|
||||
return False
|
||||
if (
|
||||
self.app_name == "casecollection"
|
||||
and not user.groups.filter(name="casecollection_checker").exists()
|
||||
):
|
||||
return False
|
||||
return True
|
||||
|
||||
@method_decorator(login_required)
|
||||
@@ -593,8 +603,8 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
def exam_cids(self, request, exam_id):
|
||||
exam = get_object_or_404(self.Exam, pk=exam_id)
|
||||
|
||||
if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
raise PermissionDenied
|
||||
#if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
# raise PermissionDenied
|
||||
|
||||
if request.user not in exam.author.all():
|
||||
if not self.check_user_access(request.user, exam_id):
|
||||
@@ -678,13 +688,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
|
||||
add = request.POST.get("add") == "true"
|
||||
|
||||
print(user_id)
|
||||
print(request.POST)
|
||||
|
||||
cid_user = CidUser.objects.get(pk=user_id)
|
||||
|
||||
app_exam_map = {}
|
||||
app_exam_map["rapids"] = cid_user.rapid_exams
|
||||
app_exam_map["casecollection"] = cid_user.casecollection_exams
|
||||
|
||||
if add:
|
||||
app_exam_map[self.app_name].add(pk)
|
||||
|
||||
Reference in New Issue
Block a user