mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
Allow org admin to create teams on UI (#8407)
* fix(client_initialization_utils.py): handle custom llm provider set with valid value not from model name * fix(handle_jwt.py): handle groups not existing in jwt token if user not in group, this won't exist * fix(handle_jwt.py): add new `enforce_team_based_model_access` flag to jwt auth allows proxy admin to enforce user can only call model if team has access * feat(navbar.tsx): expose new dropdown in navbar - allow org admin to create teams within org context * fix(navbar.tsx): remove non-functional cogicon * fix(proxy/utils.py): include user-org memberships in `/user/info` response return orgs user is a member of and the user role within org * feat(organization_endpoints.py): allow internal user to query `/organizations/list` and get all orgs they belong to enables org admin to select org they belong to, to create teams * fix(navbar.tsx): show change in ui when org switcher clicked * feat(page.tsx): update user role based on org they're in allows org admin to create teams in the org context * feat(teams.tsx): working e2e flow for allowing org admin to add new teams * style(navbar.tsx): clarify switching orgs on UI is in BETA * fix(organization_endpoints.py): handle getting but not setting members * test: fix test * fix(client_initialization_utils.py): revert custom llm provider handling fix - causing unintended issues * docs(token_auth.md): cleanup docs
This commit is contained in:
parent
fb121c82e8
commit
c55422a2f8
12 changed files with 285 additions and 142 deletions
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
import { Typography } from "antd";
|
||||
import { teamDeleteCall, teamUpdateCall, teamInfoCall } from "./networking";
|
||||
import { teamDeleteCall, teamUpdateCall, teamInfoCall, Organization } from "./networking";
|
||||
import TeamMemberModal from "@/components/team/edit_membership";
|
||||
import {
|
||||
InformationCircleIcon,
|
||||
|
@ -64,6 +64,7 @@ interface TeamProps {
|
|||
setTeams: React.Dispatch<React.SetStateAction<Object[] | null>>;
|
||||
userID: string | null;
|
||||
userRole: string | null;
|
||||
currentOrg: Organization | null;
|
||||
}
|
||||
|
||||
interface EditTeamModalProps {
|
||||
|
@ -90,6 +91,7 @@ const Team: React.FC<TeamProps> = ({
|
|||
setTeams,
|
||||
userID,
|
||||
userRole,
|
||||
currentOrg
|
||||
}) => {
|
||||
const [lastRefreshed, setLastRefreshed] = useState("");
|
||||
|
||||
|
@ -285,7 +287,7 @@ const Team: React.FC<TeamProps> = ({
|
|||
if (accessToken != null) {
|
||||
const newTeamAlias = formValues?.team_alias;
|
||||
const existingTeamAliases = teams?.map((t) => t.team_alias) ?? [];
|
||||
let organizationId = formValues?.organization_id;
|
||||
let organizationId = formValues?.organization_id || currentOrg?.organization_id;
|
||||
if (organizationId === "" || typeof organizationId !== 'string') {
|
||||
formValues.organization_id = null;
|
||||
} else {
|
||||
|
@ -618,7 +620,7 @@ const Team: React.FC<TeamProps> = ({
|
|||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
{userRole == "Admin"? (
|
||||
{userRole == "Admin" || userRole == "Org Admin"? (
|
||||
<Col numColSpan={1}>
|
||||
<Button
|
||||
className="mx-auto"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue