feat: ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS

Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2025-08-06 01:44:52 +04:00
co-authored by Classic298
parent 182192f3c9
commit 55ad48d1c3
5 changed files with 34 additions and 21 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ from fastapi import APIRouter, Depends, HTTPException, Request, status
from open_webui.utils.auth import get_admin_user, get_verified_user
from open_webui.utils.access_control import has_access, has_permission
from open_webui.config import ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS
router = APIRouter()
@@ -27,7 +27,7 @@ router = APIRouter()
@router.get("/", response_model=list[ModelUserResponse])
async def get_models(id: Optional[str] = None, user=Depends(get_verified_user)):
if user.role == "admin":
if user.role == "admin" and ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS:
return Models.get_models()
else:
return Models.get_models_by_user_id(user.id)