forked from baron/baron-sso
devfront biome 오류 수정
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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<string, unknown> | 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;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<typeof makeClient>[],
|
||||
|
||||
Reference in New Issue
Block a user