mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-28 10:35:43 +00:00
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:
1 parent
a74256cd2a
commit
e7d70497c2
6 files changed
+73
-149
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user