mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +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()
|
self.object = self.get_object()
|
||||||
if can_edit_prop(self.object, request.user):
|
if can_edit_prop(self.object, request.user):
|
||||||
return super(CanEditPropMixin, self).dispatch(request, *arg, **kwargs)
|
return super(CanEditPropMixin, self).dispatch(request, *arg, **kwargs)
|
||||||
|
return forbidden(request)
|
||||||
except: pass
|
except: pass
|
||||||
# If we get here, it's a ListView
|
# 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)]
|
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()
|
self.object = self.get_object()
|
||||||
if can_edit(self.object, request.user):
|
if can_edit(self.object, request.user):
|
||||||
return super(CanEditMixin, self).dispatch(request, *arg, **kwargs)
|
return super(CanEditMixin, self).dispatch(request, *arg, **kwargs)
|
||||||
|
return forbidden(request)
|
||||||
except: pass
|
except: pass
|
||||||
# If we get here, it's a ListView
|
# If we get here, it's a ListView
|
||||||
l_id = [o.id for o in self.get_queryset() if can_edit(o, request.user)]
|
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()
|
self.object = self.get_object()
|
||||||
if can_view(self.object, request.user):
|
if can_view(self.object, request.user):
|
||||||
return super(CanViewMixin, self).dispatch(request, *arg, **kwargs)
|
return super(CanViewMixin, self).dispatch(request, *arg, **kwargs)
|
||||||
|
return forbidden(request)
|
||||||
except: pass
|
except: pass
|
||||||
# If we get here, it's a ListView
|
# If we get here, it's a ListView
|
||||||
l_id = [o.id for o in self.get_queryset() if can_view(o, request.user)]
|
l_id = [o.id for o in self.get_queryset() if can_view(o, request.user)]
|
||||||
|
Loading…
Reference in New Issue
Block a user