mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-23 03:42:59 -05:00
* Added permission syncing on the backend * Rewored to work with celery alembic fix fixed test * frontend changes * got groups working * added comments and fixed public docs * fixed merge issues * frontend complete! * frontend cleanup and mypy fixes * refactored connector access_type selection * mypy fixes * minor refactor and frontend improvements * get to fetch * renames and comments * minor change to var names * got curator stuff working * addressed pablo's comments * refactored user_external_group to reference users table * implemented polling * small refactor * fixed a whoopsies on the frontend * added scripts to seed dummy docs and test query times * fixed frontend build issue * alembic fix * handled is_public overlap * yuhong feedback * added more checks for sync * black * mypy * fixed circular import * todos * alembic fix * alembic
25 lines
991 B
Python
25 lines
991 B
Python
from danswer.configs.constants import DocumentSource
|
|
|
|
|
|
def prefix_user_email(user_email: str) -> str:
|
|
"""Prefixes a user email to eliminate collision with group names.
|
|
This applies to both a Danswer user and an External user, this is to make the query time
|
|
more efficient"""
|
|
return f"user_email:{user_email}"
|
|
|
|
|
|
def prefix_user_group(user_group_name: str) -> str:
|
|
"""Prefixes a user group name to eliminate collision with user emails.
|
|
This assumes that user ids are prefixed with a different prefix."""
|
|
return f"group:{user_group_name}"
|
|
|
|
|
|
def prefix_external_group(ext_group_name: str) -> str:
|
|
"""Prefixes an external group name to eliminate collision with user emails / Danswer groups."""
|
|
return f"external_group:{ext_group_name}"
|
|
|
|
|
|
def prefix_group_w_source(ext_group_name: str, source: DocumentSource) -> str:
|
|
"""External groups may collide across sources, every source needs its own prefix."""
|
|
return f"{source.value.upper()}_{ext_group_name}"
|