mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 16:46:50 +01:00
Bulk edit permissions
This commit is contained in:
parent
211fbf0cf6
commit
6ece5240a5
12 changed files with 267 additions and 99 deletions
|
|
@ -5,6 +5,7 @@ from documents.models import Correspondent
|
|||
from documents.models import Document
|
||||
from documents.models import DocumentType
|
||||
from documents.models import StoragePath
|
||||
from documents.permissions import set_permissions_for_object
|
||||
from documents.tasks import bulk_update_documents
|
||||
from documents.tasks import update_document_archive_file
|
||||
|
||||
|
|
@ -128,3 +129,15 @@ def redo_ocr(doc_ids):
|
|||
)
|
||||
|
||||
return "OK"
|
||||
|
||||
|
||||
def set_permissions(doc_ids, permissions):
|
||||
|
||||
qs = Document.objects.filter(id__in=doc_ids)
|
||||
for doc in qs:
|
||||
set_permissions_for_object(permissions, doc)
|
||||
affected_docs = [doc.id for doc in qs]
|
||||
|
||||
bulk_update_documents.delay(document_ids=affected_docs)
|
||||
|
||||
return "OK"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue