diff --git a/adminfront/src/features/tenants/routes/TenantDetailPage.tsx b/adminfront/src/features/tenants/routes/TenantDetailPage.tsx index 44bad3fc..ac77a3ac 100644 --- a/adminfront/src/features/tenants/routes/TenantDetailPage.tsx +++ b/adminfront/src/features/tenants/routes/TenantDetailPage.tsx @@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query"; import { ArrowLeft } from "lucide-react"; import { Link, Outlet, useLocation, useParams } from "react-router-dom"; import { Badge } from "../../../components/ui/badge"; -import { fetchTenant } from "../../../lib/adminApi"; +import { fetchMe, fetchTenant } from "../../../lib/adminApi"; import { t } from "../../../lib/i18n"; function TenantDetailPage() { @@ -16,6 +16,14 @@ function TenantDetailPage() { enabled: tenantId.length > 0, }); + const { data: profile } = useQuery({ + queryKey: ["me"], + queryFn: fetchMe, + }); + + const canAccessSchema = + profile?.role === "super_admin" || profile?.role === "tenant_admin"; + const isFederationTab = location.pathname.includes("/federation"); const isPermissionsTab = location.pathname.includes("/permissions"); const isOrganizationTab = location.pathname.includes("/organization"); @@ -98,16 +106,18 @@ function TenantDetailPage() { > {t("ui.admin.tenants.detail.tab_organization", "조직 관리")} - - {t("ui.admin.tenants.detail.tab_schema", "사용자 스키마")} - + {canAccessSchema && ( + + {t("ui.admin.tenants.detail.tab_schema", "사용자 스키마")} + + )} {/* Outlet for nested routes */} diff --git a/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx b/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx index 1c95d705..f9a8d04a 100644 --- a/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx +++ b/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx @@ -14,7 +14,7 @@ import { } from "../../../components/ui/card"; import { Input } from "../../../components/ui/input"; import { Label } from "../../../components/ui/label"; -import { fetchTenant, updateTenant } from "../../../lib/adminApi"; +import { fetchMe, fetchTenant, updateTenant } from "../../../lib/adminApi"; import { t } from "../../../lib/i18n"; type SchemaFieldType = "text" | "number" | "boolean" | "date"; @@ -40,6 +40,38 @@ export function TenantSchemaPage() { const { tenantId } = useParams<{ tenantId: string }>(); const queryClient = useQueryClient(); + const { data: profile, isLoading: isProfileLoading } = useQuery({ + queryKey: ["me"], + queryFn: fetchMe, + }); + + const canAccess = + profile?.role === "super_admin" || profile?.role === "tenant_admin"; + + if (isProfileLoading) { + return ( +
+ {t( + "msg.admin.tenants.schema.forbidden_desc", + "사용자 스키마 설정은 관리자만 접근할 수 있습니다.", + )} +
+{t( "msg.admin.users.detail.security.password_hint",