summaryrefslogtreecommitdiffstats
path: root/src/collective/dms/batchimport/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/collective/dms/batchimport/utils.py')
-rw-r--r--src/collective/dms/batchimport/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/collective/dms/batchimport/utils.py b/src/collective/dms/batchimport/utils.py
index cc2cc35..e3a9a1c 100644
--- a/src/collective/dms/batchimport/utils.py
+++ b/src/collective/dms/batchimport/utils.py
@@ -21,7 +21,8 @@ log = logging.getLogger('collective.dms.batchimport')
def createDocument(context, folder, portal_type, document_id, filename,
- file_object, owner=None, treating_groups=None, metadata=None):
+ file_object, owner=None, treating_groups=None, recipient_groups=None,
+ metadata=None):
if owner is None:
owner = api.user.get_current().id
@@ -52,6 +53,14 @@ def createDocument(context, folder, portal_type, document_id, filename,
IDmsDocument['treating_groups'])
canwrite_dm.set([])
canwrite_dm.set(list(treating_groups))
+
+ if recipient_groups:
+ canread_dm = LocalRolesToPrincipalsDataManager(document,
+ IDmsDocument['recipient_groups'])
+ canread_dm.set([])
+ canread_dm.set(list(recipient_groups))
+
+ if treating_groups or recipient_groups:
document.reindexObjectSecurity()
version = createContentInContainer(document, 'dmsmainfile',