diff --git a/src/features/integrations/components/ApiAccessTab.tsx b/src/features/integrations/components/ApiAccessTab.tsx index 4937120..d45104e 100644 --- a/src/features/integrations/components/ApiAccessTab.tsx +++ b/src/features/integrations/components/ApiAccessTab.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Copy, KeyRound, Plus, ShieldCheck, Trash2 } from "lucide-react"; import apiClient from "../../../api/axiosInstance"; +import { useAppSelector } from "../../../store"; type ApiKeyRecord = { id: string; name: string; prefix: string; scopes: string[]; status: string; @@ -10,6 +11,9 @@ type ApiKeyRecord = { type ApiResponse = { success: boolean; data: T }; export default function ApiAccessTab() { + const user = useAppSelector((state) => state.auth.user); + const isPlatformUser = user?.type === "platform" || user?.user_type === "platform"; + const isSupportMode = isPlatformUser && Boolean(localStorage.getItem("impersonatedTenantId")); const [keys, setKeys] = useState([]); const [name, setName] = useState(""); const [expiresInDays, setExpiresInDays] = useState(90); @@ -22,7 +26,19 @@ export default function ApiAccessTab() { setKeys(response.data || []); }; - useEffect(() => { load().catch(() => setError("Could not load API keys.")); }, []); + useEffect(() => { + if (!isSupportMode) load().catch((cause: any) => setError(cause?.response?.data?.message || "Could not load API keys.")); + }, [isSupportMode]); + + if (isSupportMode) { + return ( +
+
API-key management is protected in Support Mode
+

Platform support can inspect tenant data for troubleshooting, but cannot create, view, or revoke credentials on the tenant's behalf.

+

A real tenant administrator must sign in to this workspace and open Integration Hub → API Access to manage product API keys.

+
+ ); + } const createKey = async () => { setBusy(true); setError(""); diff --git a/src/features/integrations/pages/NewIntegration.tsx b/src/features/integrations/pages/NewIntegration.tsx index e2949e4..adce02d 100644 --- a/src/features/integrations/pages/NewIntegration.tsx +++ b/src/features/integrations/pages/NewIntegration.tsx @@ -412,7 +412,7 @@ export default function NewIntegration() { > {channels.map((chan) => ( - ))}