Skip to content

Commit

Permalink
do not always get_permissions_client
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetmeleq committed Jul 9, 2024
1 parent 1158834 commit 4c59c1a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion unstructured/ingest/v2/processes/connectors/sharepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,19 @@ def enrich_permissions_on_files(self, all_file_data: list[FileData], site_url: s
]
file_data.metadata.permissions_data = permissions_data

@property
def process_permissions(self) -> bool:
return (
self.connection_config.permissions_config.permissions_tenant
and self.connection_config.permissions_config.permissions_client_cred
and self.connection_config.permissions_config.permissions_application_id
)

def run(self, **kwargs: Any) -> Generator[FileData, None, None]:
client = self.connection_config.get_client()
root_folder = self.get_root(client=client)
logger.debug(f"processing content from path: {self.index_config.path}")
if not self.index_config.omit_files:
if not self.index_config.omit_files and self.process_permissions:
files = self.list_files(root_folder, recursive=self.index_config.recursive)
file_data = [self.file_to_file_data(file=file, client=client) for file in files]
self.enrich_permissions_on_files(
Expand Down

0 comments on commit 4c59c1a

Please sign in to comment.