Chore: Consolidate to a single way to set permission on an object (#14453)

* Chore: drop set_permissions_for_object in favor of the bulk helper

The same grant rules were implemented twice, and only the bulk version
validated every action before writing, so the single-object one could leave
a partial change behind.

* Chore: type the set-permissions dict

Callers passed whatever they had, including querysets of User and Group
objects that only worked because id__in accepts a subquery.
This commit is contained in:
Trenton H authored and GitHub committed 2026-10-24 13:28:25 -07:00
1 parent a74256cd2a
commit e7d70497c2
6 files changed
+73 -149

No files matched your search

+2 -1
View File
@@ -36,6 +36,7 @@ from documents.models import DocumentType
from documents.models import PaperlessTask
from documents.models import StoragePath
from documents.models import Tag
from documents.permissions import PermissionsSpec
from documents.permissions import set_permissions_for_objects
from documents.plugins.helpers import DocumentsStatusManager
from documents.tasks import bulk_update_documents
@@ -452,7 +453,7 @@ def reprocess(doc_ids: list[int], *, remote_ocr: bool = False) -> Literal["OK"]:
def set_permissions(
doc_ids: list[int],
set_permissions: dict,
set_permissions: PermissionsSpec,
*,
owner: User | None = None,
merge: bool = False,