From 132642347f41d981f1c3493b8332f9e57c53d624 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 25 Aug 2023 16:29:15 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(endpoints.py):=20add=20curre?= =?UTF-8?q?nt=5Fuser=20dependency=20to=20get=5Fall=20endpoint=20to=20enfor?= =?UTF-8?q?ce=20authentication=20and=20authorization=20=F0=9F=9A=80=20feat?= =?UTF-8?q?(endpoints.py):=20import=20User=20model=20and=20get=5Fcurrent?= =?UTF-8?q?=5Factive=5Fuser=20function=20to=20enable=20authentication=20an?= =?UTF-8?q?d=20authorization=20in=20get=5Fall=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/endpoints.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/endpoints.py b/src/backend/langflow/api/v1/endpoints.py index 46acd4683..088c00b13 100644 --- a/src/backend/langflow/api/v1/endpoints.py +++ b/src/backend/langflow/api/v1/endpoints.py @@ -1,9 +1,11 @@ from http import HTTPStatus 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.database.models.flow import Flow 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.utils.logger import logger from fastapi import APIRouter, Depends, HTTPException, UploadFile, Body @@ -33,7 +35,7 @@ router = APIRouter(tags=["Base"]) @router.get("/all") -def get_all(): +def get_all(current_user: User = Depends(get_current_active_user)): logger.debug("Building langchain types dict") native_components = build_langchain_types_dict() # custom_components is a list of dicts