Commits

Florian Hahn committed dc03386

methods get_all_permissions and get_group_permissions return None now

Comments (0)

Files changed (1)

object_permission_backend_nonrel/backends.py

         return perm_str in new_perms
     
     def get_all_permissions(self, user_obj, obj=None):
-        if not hasattr(user_obj, '_perm_cache'):
-            if not user_obj.is_authenticated():
-                try:
-                    user_obj = User.objects.get(pk=settings.ANONYMOUS_USER_ID)
-                except User.DoesNotExist:
-                    user_obj = User(username='AnonymousUser', email='ano@nymous.xfz')
-                    user_obj.set_unusable_password()
-                
-            if obj is None:
-                return set()
-                                    
-            user_obj._perm_cache.update(self.get_user_permission(user_obj, obj))
-            user_obj._perm_cache.update(self.get_group_permission(user_obj, obj))
-
-        return user_obj._perm_cache
-            
+        return None
+    
     def get_group_permissions(self, user_obj, obj=None):
-        if not hasattr(user_obj, '_group_perm_cache'):            
-            if obj is None or not user_obj.is_authenticated():
-                user_obj._group_perm_cache = set()
-                return user_obj._group_perm_cache
-            user_obj._group_perm_cache = set()
-            try:
-                group_list = UserPermissionList.objects.get(user=user_obj)        
-                current_permission_objs = GroupObjectPermission.objects.filter(group__in=group_list.group_fk_list)
-                for p in current_permission_objs:
-                    for perm in p.permission_list:
-                        user_obj._perm_cache.add(PERM_STRING_TEMPLATE % (p.content_type, p.object_id, perm))
-
-            except UserPermissionList.DoesNotExist:
-                pass
-        return user_obj._group_perm_cache
+        return None
 
     def _create_permission_strings(self, permission_objs):
         new_perms = []