diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx index 6788e97d25d..fca487df14e 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx @@ -18,6 +18,10 @@ vi.mock("./impact_preview_alert", () => ({ React.createElement("div", { "data-testid": "impact-preview" }, `${impactResult.affected_keys_count} keys`), })); +vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({ + default: () => ({ userId: "admin-user-id", userRole: "Admin", accessToken: "test-token" }), +})); + const makePolicy = (overrides: Partial = {}): Policy => ({ policy_id: "policy-id-1", policy_name: "test-policy", @@ -71,6 +75,12 @@ describe("AddAttachmentForm", () => { }); }); + it("fetches all teams, not just teams the caller is a member of (LIT-4199)", async () => { + renderWithProviders(); + await waitFor(() => expect(networking.teamListCall).toHaveBeenCalled()); + expect(networking.teamListCall).toHaveBeenCalledWith("test-token", null, null); + }); + it("should not fetch teams, keys, or models when accessToken is null", () => { renderWithProviders(); expect(networking.teamListCall).not.toHaveBeenCalled(); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx index 57203e9ccce..635d734555d 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx @@ -56,7 +56,7 @@ const AddAttachmentForm: React.FC = ({ setIsLoadingTeams(true); setTeamsLoaded(false); try { - const teamsResponse = await teamListCall(accessToken, null, userId); + const teamsResponse = await teamListCall(accessToken, null, null); const teamsArray = Array.isArray(teamsResponse) ? teamsResponse : teamsResponse?.data || []; const teamAliases = teamsArray.map((t: any) => t.team_alias).filter(Boolean); setAvailableTeams(teamAliases);