Commits

Kai Diefenbach committed d1c61f4

Check user's permission only if there is one

Comments (0)

Files changed (1)

     ct = ContentType.objects.get_for_model(obj)
 
     while obj is not None:
-        p = ObjectPermission.objects.filter(
-            content_type=ct, content_id=obj.id, user=user, permission__codename = codename)
-
-        # if p.exists():
-        #     return True
-
-        if p.count() > 0:
-            return True
+        if user is not None:
+            p = ObjectPermission.objects.filter(
+                content_type=ct, content_id=obj.id, user=user, permission__codename = codename)
+        
+            if p.count() > 0:
+                return True
 
         p = ObjectPermission.objects.filter(
             content_type=ct, content_id=obj.id, group__in=groups, permission__codename = codename)