From 73954f4a632f1bf2e10f710bd48c68fb935a2d99 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 4 Aug 2024 16:00:52 +0100 Subject: [PATCH] fix: admins viewing shared chats with ENABLE_ADMIN_CHAT_ACCESS set to false --- backend/apps/webui/routers/chats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/webui/routers/chats.py b/backend/apps/webui/routers/chats.py index 26eefd4af..ec8e72e0b 100644 --- a/backend/apps/webui/routers/chats.py +++ b/backend/apps/webui/routers/chats.py @@ -186,7 +186,7 @@ async def get_shared_chat_by_id(share_id: str, user=Depends(get_verified_user)): status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND ) - if user.role == "user": + if user.role == "user" or (user.role == "admin" and not ENABLE_ADMIN_CHAT_ACCESS): chat = Chats.get_chat_by_share_id(share_id) elif user.role == "admin" and ENABLE_ADMIN_CHAT_ACCESS: chat = Chats.get_chat_by_id(share_id)