From a71d4fc17244b92ef0ffd3e51df5ddae1b57ea84 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 20 Apr 2024 15:55:18 -0700 Subject: [PATCH] (ui) hide default team for non admins --- .../src/components/dashboard_default_team.tsx | 11 +++++++++-- .../src/components/user_dashboard.tsx | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/litellm-dashboard/src/components/dashboard_default_team.tsx b/ui/litellm-dashboard/src/components/dashboard_default_team.tsx index b3976912b2..0abfd1a562 100644 --- a/ui/litellm-dashboard/src/components/dashboard_default_team.tsx +++ b/ui/litellm-dashboard/src/components/dashboard_default_team.tsx @@ -4,6 +4,7 @@ import { Select, SelectItem, Text, Title } from "@tremor/react"; interface DashboardTeamProps { teams: Object[] | null; setSelectedTeam: React.Dispatch>; + userRole: string | null; } type TeamInterface = { @@ -15,6 +16,7 @@ type TeamInterface = { const DashboardTeam: React.FC = ({ teams, setSelectedTeam, + userRole, }) => { const defaultTeam: TeamInterface = { models: [], @@ -25,8 +27,13 @@ const DashboardTeam: React.FC = ({ const [value, setValue] = useState(defaultTeam); - const updatedTeams = teams ? [...teams, defaultTeam] : [defaultTeam]; - + let updatedTeams; + if (userRole === "App User") { + // Non-Admin SSO users should only see their own team - they should not see "Default Team" + updatedTeams = teams; + } else { + updatedTeams = teams ? [...teams, defaultTeam] : [defaultTeam]; + } return (
diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsx index 3f6a988b3f..c06b72883d 100644 --- a/ui/litellm-dashboard/src/components/user_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx @@ -257,7 +257,7 @@ const UserDashboard: React.FC = ({ data={keys} setData={setKeys} /> - +