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({
|
||||
|
||||
Reference in New Issue
Block a user