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:
@@ -294,19 +294,6 @@ function TenantListPage() {
|
||||
});
|
||||
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({
|
||||
queryKey: ["tenants", "lazy"],
|
||||
queryFn: ({ pageParam }) =>
|
||||
@@ -319,10 +306,7 @@ function TenantListPage() {
|
||||
initialPageParam: "",
|
||||
getNextPageParam: (lastPage) =>
|
||||
lastPage.nextCursor || lastPage.next_cursor || undefined,
|
||||
enabled:
|
||||
profileRole === "super_admin" ||
|
||||
(profileRole === "tenant_admin" &&
|
||||
(profile?.manageableTenants?.length ?? 0) > 1),
|
||||
enabled: profileRole === "super_admin",
|
||||
});
|
||||
|
||||
const deleteBulkMutation = useMutation({
|
||||
|
||||
@@ -733,7 +733,10 @@ export function TenantWorksmobilePage() {
|
||||
{activeTab === "users" ? (
|
||||
<div className="space-y-4 animate-in fade-in duration-500">
|
||||
<ComparisonSummary
|
||||
title={t("ui.admin.tenants.worksmobile.compare", "Baron / Works 비교")}
|
||||
title={t(
|
||||
"ui.admin.tenants.worksmobile.compare",
|
||||
"Baron / Works 비교",
|
||||
)}
|
||||
summary={userSummary}
|
||||
/>
|
||||
<ComparisonTable
|
||||
@@ -1680,10 +1683,10 @@ function ComparisonTable({
|
||||
? {
|
||||
display: "grid",
|
||||
height: `${
|
||||
isTestEnv
|
||||
? rows.length * WORKSMOBILE_ROW_ESTIMATED_HEIGHT
|
||||
: rowVirtualizer.getTotalSize()
|
||||
}px`,
|
||||
isTestEnv
|
||||
? rows.length * WORKSMOBILE_ROW_ESTIMATED_HEIGHT
|
||||
: rowVirtualizer.getTotalSize()
|
||||
}px`,
|
||||
minWidth: tableMinWidth,
|
||||
position: "relative",
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
{...register("tenantSlug")}
|
||||
disabled={
|
||||
profile?.role === "tenant_admin" &&
|
||||
profileRole !== "super_admin" &&
|
||||
selectableRepresentativeTenants.length <= 1
|
||||
}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user