-
Notifications
You must be signed in to change notification settings - Fork 44.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into reinier/secrt-994-update-caching-for-frontend…
…-in-ci
- Loading branch information
Showing
18 changed files
with
141 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
from dataclasses import dataclass | ||
|
||
DEFAULT_USER_ID = "3e53486c-cf57-477e-ba2a-cb02dc828e1a" | ||
DEFAULT_EMAIL = "[email protected]" | ||
|
||
|
||
# Using dataclass here to avoid adding dependency on pydantic | ||
@dataclass(frozen=True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import logging | ||
from typing import Optional, cast | ||
|
||
from autogpt_libs.auth.models import DEFAULT_USER_ID | ||
from autogpt_libs.supabase_integration_credentials_store.types import ( | ||
UserIntegrations, | ||
UserMetadata, | ||
|
@@ -15,9 +16,6 @@ | |
|
||
logger = logging.getLogger(__name__) | ||
|
||
DEFAULT_USER_ID = "3e53486c-cf57-477e-ba2a-cb02dc828e1a" | ||
DEFAULT_EMAIL = "[email protected]" | ||
|
||
|
||
async def get_or_create_user(user_data: dict) -> User: | ||
user_id = user_data.get("sub") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
from autogpt_libs.auth.middleware import auth_middleware | ||
from fastapi import Depends, HTTPException | ||
from autogpt_libs.auth.depends import requires_user | ||
from autogpt_libs.auth.models import User | ||
from fastapi import Depends | ||
|
||
from backend.data.user import DEFAULT_USER_ID | ||
from backend.util.settings import Settings | ||
|
||
settings = Settings() | ||
|
||
|
||
def get_user_id(payload: dict = Depends(auth_middleware)) -> str: | ||
if not payload: | ||
# This handles the case when authentication is disabled | ||
return DEFAULT_USER_ID | ||
|
||
user_id = payload.get("sub") | ||
if not user_id: | ||
raise HTTPException(status_code=401, detail="User ID not found in token") | ||
return user_id | ||
def get_user_id(user: User = Depends(requires_user)) -> str: | ||
return user.user_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters