import { createFileRoute } from '@tanstack/react-router' import { ShieldAlert, Building2 } from 'lucide-react' import { useAuth, isSuperAdmin, isTenantAdmin } from '@/lib/auth' import { useUIStore } from '@/lib/store' import { CredentialProfilesPage } from '@/components/settings/CredentialProfilesPage' export const Route = createFileRoute('/_authenticated/settings/credentials')({ component: CredentialProfilesRoute, }) function CredentialProfilesRoute() { const { user } = useAuth() const { selectedTenantId } = useUIStore() const tenantId = isSuperAdmin(user) ? (selectedTenantId ?? '') : (user?.tenant_id ?? '') // RBAC: only tenant_admin+ can manage credential profiles if (!isTenantAdmin(user)) { return (

Access Denied

You need tenant admin or higher permissions to manage credential profiles.

) } return (
{!tenantId ? (

Select an organization from the sidebar to manage credential profiles.

) : ( )}
) }