1
0
forked from baron/baron-sso

fix: additional UI cleanup for RBAC simplification

- Simplified access control in TenantListPage and UserDetailPage.
- Final formatting and default tab fixes in TenantWorksmobilePage.
This commit is contained in:
2026-06-02 19:24:05 +09:00
parent 74068503bb
commit e5f1c85e29
3 changed files with 10 additions and 23 deletions

View File

@@ -294,19 +294,6 @@ function TenantListPage() {
}); });
const profileRole = normalizeAdminRole(profile?.role); const profileRole = normalizeAdminRole(profile?.role);
// Redirect tenant_admin ONLY if they have one or fewer manageable tenants in the list
React.useEffect(() => {
if (profile && profileRole === "tenant_admin") {
const manageableCount = profile.manageableTenants?.length ?? 0;
if (
(manageableCount === 1 || manageableCount === 0) &&
profile.tenantId
) {
navigate(`/tenants/${profile.tenantId}`, { replace: true });
}
}
}, [profile, profileRole, navigate]);
const query = useInfiniteQuery({ const query = useInfiniteQuery({
queryKey: ["tenants", "lazy"], queryKey: ["tenants", "lazy"],
queryFn: ({ pageParam }) => queryFn: ({ pageParam }) =>
@@ -319,10 +306,7 @@ function TenantListPage() {
initialPageParam: "", initialPageParam: "",
getNextPageParam: (lastPage) => getNextPageParam: (lastPage) =>
lastPage.nextCursor || lastPage.next_cursor || undefined, lastPage.nextCursor || lastPage.next_cursor || undefined,
enabled: enabled: profileRole === "super_admin",
profileRole === "super_admin" ||
(profileRole === "tenant_admin" &&
(profile?.manageableTenants?.length ?? 0) > 1),
}); });
const deleteBulkMutation = useMutation({ const deleteBulkMutation = useMutation({

View File

@@ -733,7 +733,10 @@ export function TenantWorksmobilePage() {
{activeTab === "users" ? ( {activeTab === "users" ? (
<div className="space-y-4 animate-in fade-in duration-500"> <div className="space-y-4 animate-in fade-in duration-500">
<ComparisonSummary <ComparisonSummary
title={t("ui.admin.tenants.worksmobile.compare", "Baron / Works 비교")} title={t(
"ui.admin.tenants.worksmobile.compare",
"Baron / Works 비교",
)}
summary={userSummary} summary={userSummary}
/> />
<ComparisonTable <ComparisonTable
@@ -1680,10 +1683,10 @@ function ComparisonTable({
? { ? {
display: "grid", display: "grid",
height: `${ height: `${
isTestEnv isTestEnv
? rows.length * WORKSMOBILE_ROW_ESTIMATED_HEIGHT ? rows.length * WORKSMOBILE_ROW_ESTIMATED_HEIGHT
: rowVirtualizer.getTotalSize() : rowVirtualizer.getTotalSize()
}px`, }px`,
minWidth: tableMinWidth, minWidth: tableMinWidth,
position: "relative", position: "relative",
} }

View File

@@ -1372,7 +1372,7 @@ function UserDetailPage() {
className="flex h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50" className="flex h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50"
{...register("tenantSlug")} {...register("tenantSlug")}
disabled={ disabled={
profile?.role === "tenant_admin" && profileRole !== "super_admin" &&
selectableRepresentativeTenants.length <= 1 selectableRepresentativeTenants.length <= 1
} }
> >