Allow superusers to bypass open access check in question detail view
This commit is contained in:
+3
-1
@@ -3610,7 +3610,9 @@ class GenericViewBase:
|
|||||||
def question_detail(self, request, pk):
|
def question_detail(self, request, pk):
|
||||||
question: QuestionBase = get_object_or_404(self.question_object, pk=pk)
|
question: QuestionBase = get_object_or_404(self.question_object, pk=pk)
|
||||||
|
|
||||||
if not question.open_access:
|
if request.user.is_superuser:
|
||||||
|
pass
|
||||||
|
elif not question.open_access:
|
||||||
if (
|
if (
|
||||||
not request.user.groups.filter(name=self.checker_group).exists()
|
not request.user.groups.filter(name=self.checker_group).exists()
|
||||||
and request.user not in question.author.all()
|
and request.user not in question.author.all()
|
||||||
|
|||||||
Reference in New Issue
Block a user