From bf6483039d57262f1aaeedab55321e52365fdae2 Mon Sep 17 00:00:00 2001 From: Skia Date: Sun, 18 Dec 2016 11:55:03 +0100 Subject: [PATCH] Fix performance issue in rights check --- core/views/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/views/__init__.py b/core/views/__init__.py index 75143812..c682ec71 100644 --- a/core/views/__init__.py +++ b/core/views/__init__.py @@ -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)]