Skip to content

Commit

Permalink
proper org
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 4, 2024
1 parent 06153fa commit 12d9c72
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
6 changes: 1 addition & 5 deletions backend/danswer/auth/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
from danswer.db.models import OAuthAccount
from danswer.db.models import User
from danswer.db.users import get_user_by_email
from danswer.server.utils import BasicAuthenticationError
from danswer.utils.logger import setup_logger
from danswer.utils.telemetry import optional_telemetry
from danswer.utils.telemetry import RecordType
Expand All @@ -99,11 +100,6 @@
logger = setup_logger()


class BasicAuthenticationError(HTTPException):
def __init__(self, detail: str):
super().__init__(status_code=status.HTTP_403_FORBIDDEN, detail=detail)


def is_user_admin(user: User | None) -> bool:
if AUTH_TYPE == AuthType.DISABLED:
return True
Expand Down
2 changes: 1 addition & 1 deletion backend/danswer/db/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from sqlalchemy.orm import Session
from sqlalchemy.orm import sessionmaker

from danswer.auth.users import BasicAuthenticationError
from danswer.configs.app_configs import LOG_POSTGRES_CONN_COUNTS
from danswer.configs.app_configs import LOG_POSTGRES_LATENCY
from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW
Expand All @@ -38,6 +37,7 @@
from danswer.configs.app_configs import POSTGRES_USER
from danswer.configs.app_configs import USER_AUTH_SECRET
from danswer.configs.constants import POSTGRES_UNKNOWN_APP_NAME
from danswer.server.utils import BasicAuthenticationError
from danswer.utils.logger import setup_logger
from shared_configs.configs import MULTI_TENANT
from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA
Expand Down
2 changes: 1 addition & 1 deletion backend/danswer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from danswer.auth.schemas import UserRead
from danswer.auth.schemas import UserUpdate
from danswer.auth.users import auth_backend
from danswer.auth.users import BasicAuthenticationError
from danswer.auth.users import create_danswer_oauth_router
from danswer.auth.users import fastapi_users
from danswer.configs.app_configs import APP_API_PREFIX
Expand Down Expand Up @@ -92,6 +91,7 @@
from danswer.server.token_rate_limits.api import (
router as token_rate_limit_settings_router,
)
from danswer.server.utils import BasicAuthenticationError
from danswer.setup import setup_danswer
from danswer.setup import setup_multitenant_danswer
from danswer.utils.logger import setup_logger
Expand Down
2 changes: 1 addition & 1 deletion backend/danswer/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from danswer.auth.noauth_user import set_no_auth_user_preferences
from danswer.auth.schemas import UserRole
from danswer.auth.schemas import UserStatus
from danswer.auth.users import BasicAuthenticationError
from danswer.auth.users import current_admin_user
from danswer.auth.users import current_curator_or_admin_user
from danswer.auth.users import current_user
Expand Down Expand Up @@ -60,6 +59,7 @@
from danswer.server.models import FullUserSnapshot
from danswer.server.models import InvitedUserSnapshot
from danswer.server.models import MinimalUserSnapshot
from danswer.server.utils import BasicAuthenticationError
from danswer.server.utils import send_user_email_invite
from danswer.utils.logger import setup_logger
from danswer.utils.variable_functionality import fetch_ee_implementation_or_noop
Expand Down
8 changes: 8 additions & 0 deletions backend/danswer/server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from textwrap import dedent
from typing import Any

from fastapi import HTTPException
from fastapi import status

from danswer.configs.app_configs import SMTP_PASS
from danswer.configs.app_configs import SMTP_PORT
from danswer.configs.app_configs import SMTP_SERVER
Expand All @@ -14,6 +17,11 @@
from danswer.db.models import User


class BasicAuthenticationError(HTTPException):
def __init__(self, detail: str):
super().__init__(status_code=status.HTTP_403_FORBIDDEN, detail=detail)


class DateTimeEncoder(json.JSONEncoder):
"""Custom JSON encoder that converts datetime objects to ISO format strings."""

Expand Down
2 changes: 1 addition & 1 deletion deployment/cloud_kubernetes/workers/beat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: celery-beat
image: danswer/danswer-backend-cloud:v0.12.0-cloud.beta.10
image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4
imagePullPolicy: IfNotPresent
command:
[
Expand Down
2 changes: 1 addition & 1 deletion deployment/cloud_kubernetes/workers/heavy_worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: celery-worker-heavy
image: danswer/danswer-backend-cloud:v0.12.0-cloud.beta.12
image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4
imagePullPolicy: IfNotPresent
command:
[
Expand Down
2 changes: 1 addition & 1 deletion deployment/cloud_kubernetes/workers/indexing_worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: celery-worker-indexing
image: danswer/danswer-backend-cloud:v0.12.0-cloud.beta.12
image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4
imagePullPolicy: IfNotPresent
command:
[
Expand Down
2 changes: 1 addition & 1 deletion deployment/cloud_kubernetes/workers/light_worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: celery-worker-light
image: danswer/danswer-backend-cloud:v0.12.0-cloud.beta.12
image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4
imagePullPolicy: IfNotPresent
command:
[
Expand Down
2 changes: 1 addition & 1 deletion deployment/cloud_kubernetes/workers/primary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: celery-worker-primary
image: danswer/danswer-backend-cloud:v0.12.0-cloud.beta.12
image: danswer/danswer-backend-cloud:v0.14.0-cloud.beta.4
imagePullPolicy: IfNotPresent
command:
[
Expand Down

0 comments on commit 12d9c72

Please sign in to comment.