From 2234986abd66dde99fb7ee59b012538e2d361e3b Mon Sep 17 00:00:00 2001 From: kyy Date: Tue, 9 Jun 2026 17:52:55 +0900 Subject: [PATCH] =?UTF-8?q?devfront=20biome=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devfront/src/app/routes.tsx | 2 +- devfront/src/components/layout/AppLayout.tsx | 25 ++++++++++--------- .../features/clients/clientCreateAccess.ts | 4 ++- .../developerAccessGate.test.ts | 24 ++++++++++++------ .../developer-access/developerAccessGate.ts | 6 ++--- devfront/tests/devfront-security.spec.ts | 4 +-- 6 files changed, 36 insertions(+), 29 deletions(-) diff --git a/devfront/src/app/routes.tsx b/devfront/src/app/routes.tsx index 14626658..eba8a863 100644 --- a/devfront/src/app/routes.tsx +++ b/devfront/src/app/routes.tsx @@ -9,8 +9,8 @@ import ClientDetailsPage from "../features/clients/ClientDetailsPage"; import ClientGeneralPage from "../features/clients/ClientGeneralPage"; import ClientRelationsPage from "../features/clients/ClientRelationsPage"; import ClientsPage from "../features/clients/ClientsPage"; -import DeveloperRequestPage from "../features/developer-request/DeveloperRequestPage"; import DeveloperGrantsPage from "../features/developer-grants/DeveloperGrantsPage"; +import DeveloperRequestPage from "../features/developer-request/DeveloperRequestPage"; import GlobalOverviewPage from "../features/overview/GlobalOverviewPage"; import ProfilePage from "../features/profile/ProfilePage"; import { DEVFRONT_AUTH_CALLBACK_PATH } from "../lib/authConfig"; diff --git a/devfront/src/components/layout/AppLayout.tsx b/devfront/src/components/layout/AppLayout.tsx index be7cd1f1..21002e45 100644 --- a/devfront/src/components/layout/AppLayout.tsx +++ b/devfront/src/components/layout/AppLayout.tsx @@ -2,9 +2,9 @@ import { useQuery } from "@tanstack/react-query"; import { ChevronDown, ClipboardCheck, + KeyRound, LayoutDashboard, LogOut, - KeyRound, Moon, NotebookTabs, ShieldHalf, @@ -351,17 +351,18 @@ function AppLayout() { auth.user?.profile as Record | undefined, ); const displayRoleKey = profile?.role || currentRole; - const navItems = displayRoleKey === "super_admin" - ? [ - ...baseNavItems, - { - labelKey: "ui.dev.nav.developer_grants", - labelFallback: "Developer Access Grants", - to: "/developer-grants", - icon: KeyRound, - }, - ] - : baseNavItems; + const navItems = + displayRoleKey === "super_admin" + ? [ + ...baseNavItems, + { + labelKey: "ui.dev.nav.developer_grants", + labelFallback: "Developer Access Grants", + to: "/developer-grants", + icon: KeyRound, + }, + ] + : baseNavItems; const handleSessionExpiryToggle = () => { setIsSessionExpiryEnabled((prev) => { const next = !prev; diff --git a/devfront/src/features/clients/clientCreateAccess.ts b/devfront/src/features/clients/clientCreateAccess.ts index eeb088a9..ddb2af34 100644 --- a/devfront/src/features/clients/clientCreateAccess.ts +++ b/devfront/src/features/clients/clientCreateAccess.ts @@ -31,7 +31,9 @@ export function resolveClientCreateAccess({ return "can_create"; } - if (hasDeveloperAccessForPages(accessStatus?.approvedPages, ["client_create"])) { + if ( + hasDeveloperAccessForPages(accessStatus?.approvedPages, ["client_create"]) + ) { return "can_create"; } diff --git a/devfront/src/features/developer-access/developerAccessGate.test.ts b/devfront/src/features/developer-access/developerAccessGate.test.ts index 00f51090..3eea95ce 100644 --- a/devfront/src/features/developer-access/developerAccessGate.test.ts +++ b/devfront/src/features/developer-access/developerAccessGate.test.ts @@ -35,10 +35,14 @@ describe("developer access gate", () => { }); expect( - resolveDeveloperAccessGate("user", { - status: "pending", - pendingPages: ["audit"], - }, ["audit"]), + resolveDeveloperAccessGate( + "user", + { + status: "pending", + pendingPages: ["audit"], + }, + ["audit"], + ), ).toEqual({ hasDeveloperAccess: false, isDeveloperRequestPending: true, @@ -46,10 +50,14 @@ describe("developer access gate", () => { }); expect( - resolveDeveloperAccessGate("user", { - status: "approved", - approvedPages: ["overview"], - }, ["audit"]), + resolveDeveloperAccessGate( + "user", + { + status: "approved", + approvedPages: ["overview"], + }, + ["audit"], + ), ).toEqual({ hasDeveloperAccess: false, isDeveloperRequestPending: false, diff --git a/devfront/src/features/developer-access/developerAccessGate.ts b/devfront/src/features/developer-access/developerAccessGate.ts index 342d38eb..18e8379e 100644 --- a/devfront/src/features/developer-access/developerAccessGate.ts +++ b/devfront/src/features/developer-access/developerAccessGate.ts @@ -4,9 +4,9 @@ import { fetchDeveloperRequestStatus, } from "../../lib/devApi"; import { + type DeveloperAccessPage, hasDeveloperAccessForPages, isDeveloperRequestPendingForPages, - type DeveloperAccessPage, } from "./developerAccessPages"; export type DeveloperAccessGateState = { @@ -33,9 +33,7 @@ export function resolveDeveloperAccessGate( requiredPages, ); const canRequestDeveloperAccess = - profileRole === "user" && - !hasDeveloperAccess && - !isDeveloperRequestPending; + profileRole === "user" && !hasDeveloperAccess && !isDeveloperRequestPending; return { hasDeveloperAccess, diff --git a/devfront/tests/devfront-security.spec.ts b/devfront/tests/devfront-security.spec.ts index c10644a2..14c1e69e 100644 --- a/devfront/tests/devfront-security.spec.ts +++ b/devfront/tests/devfront-security.spec.ts @@ -59,9 +59,7 @@ test.describe("DevFront security and isolation", () => { await expect(page.getByText("Server side App")).not.toBeVisible(); }); - test("user can enter DevFront and sees empty RP list", async ({ - page, - }) => { + test("user can enter DevFront and sees empty RP list", async ({ page }) => { await seedAuth(page, "user"); const state = { clients: [] as ReturnType[],