Skip to content

Commit

Permalink
fix(user_dashboard.tsx): ensure non admin can't view other keys
Browse files Browse the repository at this point in the history
  • Loading branch information
krrishdholakia committed Feb 7, 2025
1 parent 296b645 commit 5efc6f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/litellm-dashboard/src/components/create_key_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const CreateKey: React.FC<CreateKeyProps> = ({

message.info("Making API Call");
setIsModalVisible(true);

if(keyOwner === "you"){
formValues.user_id = userID
}
Expand Down
5 changes: 4 additions & 1 deletion ui/litellm-dashboard/src/components/user_dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,12 @@ const UserDashboard: React.FC<UserDashboardProps> = ({
} else {
setKeys(
response["keys"].concat(
response.teams.flatMap((team: any) => team.keys)
response.teams
.filter((team: any) => userRole === "Admin" || team.user_id === userID)
.flatMap((team: any) => team.keys)
)
);

}

const teamsArray = [...response["teams"]];
Expand Down

0 comments on commit 5efc6f7

Please sign in to comment.