mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-23 07:52:23 +00:00
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:
|
||||
return super().get_object(queryset)
|
||||
except Http404 as e:
|
||||
try:
|
||||
super().get_object(self.get_queryset(filter_permissions=False))
|
||||
raise PermissionDenied()
|
||||
except Http404:
|
||||
if self.get_queryset(filter_permissions=False).count() == self.get_queryset().count():
|
||||
raise e
|
||||
raise PermissionDenied()
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
|
Loading…
Reference in New Issue
Block a user