community[patch]: Add support for authorized identities in PebbloSafeLoader. (#20055)

Description: Add support for authorized identities in PebbloSafeLoader.
Now with this change, PebbloSafeLoader will extract
authorized_identities from metadata and send it to pebblo server
Dependencies: None
Documentation: None

Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
This commit is contained in:
Rahul Triptahi 2024-04-17 07:04:06 +05:30 committed by GitHub
parent 475892ca0e
commit 2cbfc94bcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,6 +132,9 @@ class PebbloSafeLoader(BaseLoader):
doc_content = [doc.dict() for doc in self.docs]
docs = []
for doc in doc_content:
doc_authorized_identities = doc.get("metadata", {}).get(
"authorized_identities", []
)
doc_source_path = get_full_path(
doc.get("metadata", {}).get("source", self.source_path)
)
@ -148,6 +151,11 @@ class PebbloSafeLoader(BaseLoader):
"source_path": doc_source_path,
"last_modified": doc.get("metadata", {}).get("last_modified"),
"file_owner": doc_source_owner,
**(
{"authorized_identities": doc_authorized_identities}
if doc_authorized_identities
else {}
),
**(
{"source_path_size": doc_source_size}
if doc_source_size is not None