-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added confluence permission syncing #2537
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
# The url and the id are the same | ||
page_url = generate_confluence_document_id( | ||
self.wiki_base, page["_links"]["webui"] | ||
) | ||
if not page_html: | ||
logger.debug("Page is empty, skipping: %s", page_url) | ||
continue | ||
page_text = parse_html_page(page_html, self.confluence_client) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unused argument from function and function calls
@@ -105,24 +109,6 @@ def parse_html_page(text: str, confluence_client: Confluence) -> str: | |||
return format_document_soup(soup) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to utils file
@@ -13,3 +16,11 @@ def get_default_document_index( | |||
return VespaIndex( | |||
index_name=primary_index_name, secondary_index_name=secondary_index_name | |||
) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they may be able to be used elsewhere
@@ -220,8 +220,8 @@ def index_doc_batch_prepare( | |||
|
|||
document_ids = [document.id for document in documents] | |||
db_docs: list[DBDocument] = get_documents_by_ids( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing the calling order wherever i can to make the codebase uniform :p
@@ -11,12 +11,25 @@ | |||
from danswer.utils.logger import setup_logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in this module is just refactoring the group and doc permission syncing to be seperate
from ee.danswer.external_permissions.permission_sync_function_map import ( | ||
GROUP_PERMISSIONS_FUNC_MAP, | ||
) | ||
from ee.danswer.external_permissions.permission_sync_utils import ( | ||
get_docs_with_additional_info, | ||
) | ||
|
||
logger = setup_logger() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just read the function names/comments
[ | ||
Session, | ||
ConnectorCredentialPair, | ||
], | ||
None, | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we made the source based sync functions only require the cc_pair and the session to make them more generic.
if the endpoints for a source need to run the connector to get the DocsWithAdditionalInfo, that code will be located in that endpoint
@@ -11,6 +11,7 @@ export const autoSyncConfigBySource: Record< | |||
} | |||
> | |||
> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no extra setup required to enable this one
|
||
|
||
def upgrade() -> None: | ||
# Drop the existing primary key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last pr, I indicated that the user_id and the external_user_group_id were both primary in the models.py, but not in the alembic file. so this fixes that
@@ -0,0 +1,22 @@ | |||
import bs4 | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I exported this function into a utils file so when I generate the id in the permission sync and when i generate the id in the connector, they match.
Maybe even more of the logic can be exported to here to make sure they match but this is it for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to think about the logic while review this code but seems ok. Potentially issue with an if/elif of users and groups (commented)
backend/alembic/versions/46b7a812670f_add_cc_pair_id_to_user__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving by proxy for Yuhong
No description provided.