Files
supabase/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx
T
32b5d8c244 feat: enable Self-Service Single Sign-On (SSO) for orgs (#36732)
* Start

* Add join org logic

* Regenerate the API types and add RQ hooks.

* Various fixes to the UI for SSO config.

* Refactor the components to use RHF.

* Fix the loading/error states in the main file.

* fix: minor changes to SSO UI

* Expanded default attribute mapping preset for `Okta` to include `user_name`, `first_name`, and `last_name` to match our docs.
* Normalized role casing in the "Join Organization on Signup" dropdown to match the roles expected by the backend (`Owner`, `Administrator`, `Developer`).
* Added the role (`Read-only`) to the selectable roles for auto-join.
* Call update mutation when an `ssoConfig` has been retrieved.
* Treats `404` as a valid "create" flow state rather than an error.
* Conditionally renders the SSO config form when config is successfully loaded *or* when the provider is not found, allowing users to onboard from scratch and disable the provider.

* chore: prettier

* feat: add a button linking to SSO setup docs

* Revert "feat: add a button linking to SSO setup docs"

This will be included in a separate docs pr.

This reverts commit 0b616fdd2e.

* General clean up

* Nit copy

* Add empty state for SSO

* Smol change

* One last tweak

---------

Co-authored-by: Chris Stockton <180184+cstockton@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-05 17:03:30 -07:00

76 lines
2.0 KiB
TypeScript

import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { useCurrentPath } from 'hooks/misc/useCurrentPath'
import { NavMenu, NavMenuItem } from 'ui'
import { ScaffoldContainerLegacy, ScaffoldTitle } from '../Scaffold'
function OrganizationSettingsLayout({ children }: PropsWithChildren) {
const { slug } = useParams()
// Get the path without any hash values
const fullCurrentPath = useCurrentPath()
const [currentPath] = fullCurrentPath.split('#')
// Hide these settings in the new layout on the following paths
const isHidden = (path: string) => {
return (
path === `/org/${slug}/team` ||
path === `/org/${slug}/integrations` ||
path === `/org/${slug}/usage` ||
path === `/org/${slug}/billing`
)
}
if (isHidden(currentPath)) {
return children
}
const navMenuItems = [
{
label: 'General',
href: `/org/${slug}/general`,
},
{
label: 'Security',
href: `/org/${slug}/security`,
},
{
label: 'OAuth Apps',
href: `/org/${slug}/apps`,
},
{
label: 'SSO',
href: `/org/${slug}/sso`,
},
{
label: 'Audit Logs',
href: `/org/${slug}/audit`,
},
{
label: 'Legal Documents',
href: `/org/${slug}/documents`,
},
]
return (
<>
<ScaffoldContainerLegacy className="mb-0">
<ScaffoldTitle>Organization Settings</ScaffoldTitle>
<NavMenu className="overflow-x-auto" aria-label="Organization menu navigation">
{(navMenuItems.filter(Boolean) as { label: string; href: string }[]).map((item) => (
<NavMenuItem key={item.label} active={currentPath === item.href}>
<Link href={item.href}>{item.label}</Link>
</NavMenuItem>
))}
</NavMenu>
</ScaffoldContainerLegacy>
<main className="h-full w-full overflow-y-auto">{children}</main>
</>
)
}
export default OrganizationSettingsLayout