From 719c2da525003b7e9dfe8e3b6c94d5a9f421b38d Mon Sep 17 00:00:00 2001
From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com>
Date: Wed, 8 Jul 2026 10:43:11 +0530
Subject: [PATCH] feat(api-keys): implement API keys management interface and
access control
- Added a new WorkspaceApiAccessControl component for managing API key access within workspaces.
- Enhanced the PlaygroundApiKeysPage to display API key creation options and access information.
- Updated PlaygroundIndex and PlaygroundSidebar to include links to the new API keys management section.
- Improved user feedback with alerts and descriptions regarding API key usage and requirements.
---
.../playground/api-keys/page.tsx | 35 +++++-
.../components/playground-index.tsx | 17 ++-
.../ui/playground/PlaygroundSidebar.tsx | 8 +-
.../settings/general-settings-manager.tsx | 43 +-------
.../settings/workspace-api-access-control.tsx | 100 ++++++++++++++++++
5 files changed, 158 insertions(+), 45 deletions(-)
create mode 100644 surfsense_web/components/settings/workspace-api-access-control.tsx
diff --git a/surfsense_web/app/dashboard/[workspace_id]/playground/api-keys/page.tsx b/surfsense_web/app/dashboard/[workspace_id]/playground/api-keys/page.tsx
index 2df3ec58e..28a532e92 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/playground/api-keys/page.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/playground/api-keys/page.tsx
@@ -1,4 +1,8 @@
-import { redirect } from "next/navigation";
+import { Info } from "lucide-react";
+import { WorkspaceApiAccessControl } from "@/components/settings/workspace-api-access-control";
+import { Alert, AlertDescription } from "@/components/ui/alert";
+import { Separator } from "@/components/ui/separator";
+import { ApiKeyContent } from "../../user-settings/components/ApiKeyContent";
export default async function PlaygroundApiKeysPage({
params,
@@ -6,6 +10,33 @@ export default async function PlaygroundApiKeysPage({
params: Promise<{ workspace_id: string }>;
}) {
const { workspace_id } = await params;
+ const workspaceId = Number(workspace_id);
- redirect(`/dashboard/${workspace_id}/user-settings/api-key`);
+ return (
+
+
+
API keys
+
+ Create user API keys and choose whether they can access this workspace.
+
+
+
+
+
+
+ External API calls need both a user API key and workspace API key access enabled.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
}
diff --git a/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-index.tsx b/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-index.tsx
index 7e9d45373..58d56e146 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-index.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-index.tsx
@@ -1,6 +1,6 @@
"use client";
-import { ArrowRight, History, Info } from "lucide-react";
+import { ArrowRight, History, Info, KeyRound } from "lucide-react";
import Link from "next/link";
import { useMemo } from "react";
import { Alert, AlertDescription } from "@/components/ui/alert";
@@ -27,7 +27,7 @@ export function PlaygroundIndex({ workspaceId }: { workspaceId: number }) {
Manually run SurfSense's platform-native APIs and inspect their output. To use these APIs outside SurfSense,{" "}
create an API key
@@ -51,6 +51,19 @@ export function PlaygroundIndex({ workspaceId }: { workspaceId: number }) {
+
+