Skip to content
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

Merged
merged 10 commits into from
Sep 26, 2024
Merged

Conversation

hagen-danswer
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Sep 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2024 9:51pm

# 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)

Copy link
Contributor Author

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)


Copy link
Contributor Author

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
)


Copy link
Contributor Author

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(
Copy link
Contributor Author

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
Copy link
Contributor Author

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()


Copy link
Contributor Author

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,
]

Copy link
Contributor Author

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<
}
>
> = {
Copy link
Contributor Author

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
Copy link
Contributor Author

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


Copy link
Contributor Author

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

Copy link
Contributor

@yuhongsun96 yuhongsun96 left a 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)

Copy link
Contributor

@rkuo-danswer rkuo-danswer left a 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

@hagen-danswer hagen-danswer added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit b97cc01 Sep 26, 2024
7 checks passed
@hagen-danswer hagen-danswer deleted the confluence-permission-syncing branch September 26, 2024 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants