Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: split user / group objects error (#6302)

shamoon957691c454b7
diff --git a/src/documents/data_models.py b/src/documents/data_models.py
index 4922b72dd..22572709f 100644
--- a/src/documents/data_models.py
+++ b/src/documents/data_models.py
@@ -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