🔧 fix(endpoints.py): add current_user dependency to get_all endpoint to enforce authentication and authorization
🚀 feat(endpoints.py): import User model and get_current_active_user function to enable authentication and authorization in get_all endpoint
This commit is contained in:
parent
2af4508e5e
commit
132642347f
1 changed files with 3 additions and 1 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Annotated, Optional, Union
|
from typing import Annotated, Optional, Union
|
||||||
|
from langflow.services.auth.utils import get_current_active_user
|
||||||
|
|
||||||
from langflow.services.cache.utils import save_uploaded_file
|
from langflow.services.cache.utils import save_uploaded_file
|
||||||
from langflow.services.database.models.flow import Flow
|
from langflow.services.database.models.flow import Flow
|
||||||
from langflow.processing.process import process_graph_cached, process_tweaks
|
from langflow.processing.process import process_graph_cached, process_tweaks
|
||||||
|
from langflow.services.database.models.user.user import User
|
||||||
from langflow.services.utils import get_settings_manager
|
from langflow.services.utils import get_settings_manager
|
||||||
from langflow.utils.logger import logger
|
from langflow.utils.logger import logger
|
||||||
from fastapi import APIRouter, Depends, HTTPException, UploadFile, Body
|
from fastapi import APIRouter, Depends, HTTPException, UploadFile, Body
|
||||||
|
|
@ -33,7 +35,7 @@ router = APIRouter(tags=["Base"])
|
||||||
|
|
||||||
|
|
||||||
@router.get("/all")
|
@router.get("/all")
|
||||||
def get_all():
|
def get_all(current_user: User = Depends(get_current_active_user)):
|
||||||
logger.debug("Building langchain types dict")
|
logger.debug("Building langchain types dict")
|
||||||
native_components = build_langchain_types_dict()
|
native_components = build_langchain_types_dict()
|
||||||
# custom_components is a list of dicts
|
# custom_components is a list of dicts
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue