mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-28 21:05:17 +02:00
explicitly set page and attachment restrictions and space keys
This commit is contained in:
@@ -277,9 +277,11 @@ class ConfluenceConnector(LoadConnector, PollConnector, SlimConnector):
|
|||||||
):
|
):
|
||||||
# If the page has restrictions, add them to the perm_sync_data
|
# If the page has restrictions, add them to the perm_sync_data
|
||||||
# These will be used by doc_sync.py to sync permissions
|
# These will be used by doc_sync.py to sync permissions
|
||||||
perm_sync_data = {
|
page_restrictions = page.get("restrictions")
|
||||||
"restrictions": page.get("restrictions", {}),
|
page_space_key = page.get("space", {}).get("key")
|
||||||
"space_key": page.get("space", {}).get("key"),
|
page_perm_sync_data = {
|
||||||
|
"restrictions": page_restrictions or {},
|
||||||
|
"space_key": page_space_key,
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_metadata_list.append(
|
doc_metadata_list.append(
|
||||||
@@ -289,7 +291,7 @@ class ConfluenceConnector(LoadConnector, PollConnector, SlimConnector):
|
|||||||
page["_links"]["webui"],
|
page["_links"]["webui"],
|
||||||
self.is_cloud,
|
self.is_cloud,
|
||||||
),
|
),
|
||||||
perm_sync_data=perm_sync_data,
|
perm_sync_data=page_perm_sync_data,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
attachment_cql = f"type=attachment and container='{page['id']}'"
|
attachment_cql = f"type=attachment and container='{page['id']}'"
|
||||||
@@ -301,6 +303,19 @@ class ConfluenceConnector(LoadConnector, PollConnector, SlimConnector):
|
|||||||
):
|
):
|
||||||
if not validate_attachment_filetype(attachment):
|
if not validate_attachment_filetype(attachment):
|
||||||
continue
|
continue
|
||||||
|
attachment_restrictions = attachment.get("restrictions")
|
||||||
|
if not attachment_restrictions:
|
||||||
|
attachment_restrictions = page_restrictions
|
||||||
|
|
||||||
|
attachment_space_key = attachment.get("space", {}).get("key")
|
||||||
|
if not attachment_space_key:
|
||||||
|
attachment_space_key = page_space_key
|
||||||
|
|
||||||
|
attachment_perm_sync_data = {
|
||||||
|
"restrictions": attachment_restrictions or {},
|
||||||
|
"space_key": attachment_space_key,
|
||||||
|
}
|
||||||
|
|
||||||
doc_metadata_list.append(
|
doc_metadata_list.append(
|
||||||
SlimDocument(
|
SlimDocument(
|
||||||
id=build_confluence_document_id(
|
id=build_confluence_document_id(
|
||||||
@@ -308,7 +323,7 @@ class ConfluenceConnector(LoadConnector, PollConnector, SlimConnector):
|
|||||||
attachment["_links"]["webui"],
|
attachment["_links"]["webui"],
|
||||||
self.is_cloud,
|
self.is_cloud,
|
||||||
),
|
),
|
||||||
perm_sync_data=perm_sync_data,
|
perm_sync_data=attachment_perm_sync_data,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if len(doc_metadata_list) > _SLIM_DOC_BATCH_SIZE:
|
if len(doc_metadata_list) > _SLIM_DOC_BATCH_SIZE:
|
||||||
|
Reference in New Issue
Block a user