1
0
forked from baron/baron-sso

super admin RP 관계 관리 버튼 활성화

This commit is contained in:
2026-05-26 17:03:16 +09:00
parent 6512fea8fe
commit 509029f8f3
2 changed files with 54 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ import {
} from "../../lib/devApi";
import { t } from "../../lib/i18n";
import { resolveProfileRole } from "../../lib/role";
import { fetchMe } from "../auth/authApi";
import { ClientDetailTabs } from "./ClientDetailTabs";
const relationOptions = [
@@ -91,6 +92,13 @@ function ClientRelationsPage() {
const systemRole = resolveProfileRole(
auth.user?.profile as Record<string, unknown> | undefined,
);
const hasAccessToken = Boolean(auth.user?.access_token);
const { data: me } = useQuery({
queryKey: ["userMe"],
queryFn: fetchMe,
enabled: hasAccessToken,
});
const resolvedSystemRole = me?.role?.trim() || systemRole;
const { data: clientData } = useQuery({
queryKey: ["client", clientId],
@@ -109,7 +117,7 @@ function ClientRelationsPage() {
});
// Calculate permissions for UI hints and button states
const isSuperAdmin = systemRole === "super_admin";
const isSuperAdmin = resolvedSystemRole === "super_admin";
const myUserId = auth.user?.profile.sub;
const isRpAdmin = useMemo(() => {
if (isSuperAdmin) return true;