mirror of https://gitlab.crans.org/bde/nk20
Returning 403 when you don't have enough permissions
This commit is contained in:
parent
b8f81048a5
commit
cbf92651f0
|
@ -35,11 +35,9 @@ class ProtectQuerysetMixin:
|
||||||
try:
|
try:
|
||||||
return super().get_object(queryset)
|
return super().get_object(queryset)
|
||||||
except Http404 as e:
|
except Http404 as e:
|
||||||
try:
|
if self.get_queryset(filter_permissions=False).count() == self.get_queryset().count():
|
||||||
super().get_object(self.get_queryset(filter_permissions=False))
|
|
||||||
raise PermissionDenied()
|
|
||||||
except Http404:
|
|
||||||
raise e
|
raise e
|
||||||
|
raise PermissionDenied()
|
||||||
|
|
||||||
def get_form(self, form_class=None):
|
def get_form(self, form_class=None):
|
||||||
form = super().get_form(form_class)
|
form = super().get_form(form_class)
|
||||||
|
|
Loading…
Reference in New Issue