Update tenant logic (#4122)

* k

* k

* k

* quick nit

* nit
This commit is contained in:
pablonyx
2025-02-25 19:53:46 -08:00
committed by GitHub
parent 6f389dc100
commit a98dcbc7de
58 changed files with 155 additions and 186 deletions

View File

@@ -620,7 +620,7 @@ def associate_credential_to_connector(
)
try:
validate_ccpair_for_user(connector_id, credential_id, db_session, tenant_id)
validate_ccpair_for_user(connector_id, credential_id, db_session)
response = add_credential_to_connector(
db_session=db_session,

View File

@@ -902,7 +902,6 @@ def create_connector_with_mock_credential(
connector_id=connector_id,
credential_id=credential_id,
db_session=db_session,
tenant_id=tenant_id,
)
response = add_credential_to_connector(
db_session=db_session,

View File

@@ -18,7 +18,6 @@ from onyx.db.credentials import fetch_credentials_by_source_for_user
from onyx.db.credentials import fetch_credentials_for_user
from onyx.db.credentials import swap_credentials_connector
from onyx.db.credentials import update_credential
from onyx.db.engine import get_current_tenant_id
from onyx.db.engine import get_session
from onyx.db.models import DocumentSource
from onyx.db.models import User
@@ -100,13 +99,11 @@ def swap_credentials_for_connector(
credential_swap_req: CredentialSwapRequest,
user: User | None = Depends(current_user),
db_session: Session = Depends(get_session),
tenant_id: str | None = Depends(get_current_tenant_id),
) -> StatusResponse:
validate_ccpair_for_user(
credential_swap_req.connector_id,
credential_swap_req.new_credential_id,
db_session,
tenant_id,
)
connector_credential_pair = swap_credentials_connector(

View File

@@ -5,6 +5,7 @@ from pydantic import BaseModel
from onyx.configs.constants import NotificationType
from onyx.db.models import Notification as NotificationDBModel
from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA
class PageType(str, Enum):
@@ -54,4 +55,4 @@ class Settings(BaseModel):
class UserSettings(Settings):
notifications: list[Notification]
needs_reindexing: bool
tenant_id: str | None = None
tenant_id: str = POSTGRES_DEFAULT_SCHEMA