]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: split user / group objects error (#6302)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sat, 6 Apr 2024 20:51:50 +0000 (13:51 -0700)
committerGitHub <noreply@github.com>
Sat, 6 Apr 2024 20:51:50 +0000 (13:51 -0700)
src/documents/data_models.py

index 4922b72dd306674cdd64eeaff9c7aa737f4d4d80..22572709ff3a7ed646d0570b2c97a02cdc8e7025 100644 (file)
@@ -103,14 +103,18 @@ class DocumentMetadataOverrides:
         overrides.owner_id = doc.owner.id if doc.owner else None
         overrides.tag_ids = list(doc.tags.values_list("id", flat=True))
 
-        overrides.view_users = get_users_with_perms(
-            doc,
-            only_with_perms_in=["view_document"],
-        ).values_list("id", flat=True)
-        overrides.change_users = get_users_with_perms(
-            doc,
-            only_with_perms_in=["change_document"],
-        ).values_list("id", flat=True)
+        overrides.view_users = list(
+            get_users_with_perms(
+                doc,
+                only_with_perms_in=["view_document"],
+            ).values_list("id", flat=True),
+        )
+        overrides.change_users = list(
+            get_users_with_perms(
+                doc,
+                only_with_perms_in=["change_document"],
+            ).values_list("id", flat=True),
+        )
         overrides.custom_field_ids = list(
             doc.custom_fields.values_list("id", flat=True),
         )
@@ -120,10 +124,14 @@ class DocumentMetadataOverrides:
             attach_perms=True,
         )
         overrides.view_groups = [
-            group.id for group, perms in groups_with_perms if "view_document" in perms
+            group.id
+            for group in groups_with_perms
+            if "view_document" in groups_with_perms[group]
         ]
         overrides.change_groups = [
-            group.id for group, perms in groups_with_perms if "change_document" in perms
+            group.id
+            for group in groups_with_perms
+            if "change_document" in groups_with_perms[group]
         ]
 
         return overrides