Fixed tenant management
This commit is contained in:
@@ -354,3 +354,29 @@ export const ClaimProtectedRoute: React.FC<{
|
||||
|
||||
return React.createElement(React.Fragment, null, children);
|
||||
};
|
||||
|
||||
/**
|
||||
* Route protection for Tenant Management (Solution Owners [Tenant 1 + Admin] OR Tenant Self-Service users).
|
||||
*/
|
||||
export const TenantManagementProtectedRoute: React.FC<{
|
||||
children: React.ReactNode;
|
||||
}> = ({ children }) => {
|
||||
const { canManageTenants, isLoading } = useAuth();
|
||||
const { canView, canAccess } = useRbac();
|
||||
|
||||
if (isLoading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const hasAccess =
|
||||
canManageTenants ||
|
||||
canView('tenant_management') ||
|
||||
canView('tenant_self_service') ||
|
||||
canAccess('tenant_self_service');
|
||||
|
||||
if (!hasAccess) {
|
||||
return React.createElement(Navigate, { to: '/dashboard', replace: true });
|
||||
}
|
||||
|
||||
return React.createElement(React.Fragment, null, children);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user