mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-23 00:01:16 +00:00
Fix performance issue in rights check
This commit is contained in:
parent
8de0d54940
commit
bf6483039d
@ -62,6 +62,7 @@ class CanEditPropMixin(View):
|
||||
self.object = self.get_object()
|
||||
if can_edit_prop(self.object, request.user):
|
||||
return super(CanEditPropMixin, self).dispatch(request, *arg, **kwargs)
|
||||
return forbidden(request)
|
||||
except: pass
|
||||
# If we get here, it's a ListView
|
||||
l_id = [o.id for o in self.get_queryset() if can_edit_prop(o, request.user)]
|
||||
@ -83,6 +84,7 @@ class CanEditMixin(View):
|
||||
self.object = self.get_object()
|
||||
if can_edit(self.object, request.user):
|
||||
return super(CanEditMixin, self).dispatch(request, *arg, **kwargs)
|
||||
return forbidden(request)
|
||||
except: pass
|
||||
# If we get here, it's a ListView
|
||||
l_id = [o.id for o in self.get_queryset() if can_edit(o, request.user)]
|
||||
@ -104,6 +106,7 @@ class CanViewMixin(View):
|
||||
self.object = self.get_object()
|
||||
if can_view(self.object, request.user):
|
||||
return super(CanViewMixin, self).dispatch(request, *arg, **kwargs)
|
||||
return forbidden(request)
|
||||
except: pass
|
||||
# If we get here, it's a ListView
|
||||
l_id = [o.id for o in self.get_queryset() if can_view(o, request.user)]
|
||||
|
Loading…
Reference in New Issue
Block a user