Files
supabase/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
T
Joshen LimandTerry Sutton 39639a4073 chore/disable-more-sections-03 (#38060)
* Add flags for policies, third party auth, and manual linking + providers in sign in page

* Add flag for rate limitm page

* Add UnknownInterface components

* Update comment

* Flip flags to true

* Add flags for realtime policies and reports page

* Temp

* Add flag for sign in providers page

* Add flag for stripe wrapper

* Add flag for custom domains

* Add flag for dedicated ipv4 address addon

* Add empty state for realtime policies

* Add empty state for reports page

* Add flag for disable legacy JWT keys section

* Add flag for legacy jwt keys

* nit

* Remove ConnectionStringMoved call out

* Add flag for project settings log drains

* Add flag for subscription link in project settings

* Deprecate settings/auth page and redirect directly to auth page

* Flip back flags

* Add flags for account preferences analytics marketing and account deleetion

* Remove 'table_editor:enable_rls_toggle' flag and revert UI changes

* Remove 'authentication:policies' flag and revert UI changes

* Update flags

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2025-08-20 21:50:53 +08:00

127 lines
3.7 KiB
TypeScript

import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import { IS_PLATFORM } from 'lib/constants'
export const generateAuthMenu = (
ref: string,
flags?: {
authenticationSignInProviders: boolean
authenticationRateLimits: boolean
authenticationEmails: boolean
authenticationMultiFactor: boolean
authenticationAttackProtection: boolean
authenticationAdvanced: boolean
}
): ProductMenuGroup[] => {
const {
authenticationSignInProviders,
authenticationRateLimits,
authenticationEmails,
authenticationMultiFactor,
authenticationAttackProtection,
authenticationAdvanced,
} = flags ?? {}
return [
{
title: 'Manage',
items: [{ name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] }],
},
{
title: 'Configuration',
items: [
{
name: 'Policies',
key: 'policies',
url: `/project/${ref}/auth/policies`,
items: [],
},
...(IS_PLATFORM
? [
...(authenticationSignInProviders
? [
{
name: 'Sign In / Providers',
key: 'sign-in-up',
pages: ['providers', 'third-party'],
url: `/project/${ref}/auth/providers`,
items: [],
},
]
: []),
{
name: 'Sessions',
key: 'sessions',
url: `/project/${ref}/auth/sessions`,
items: [],
},
...(authenticationRateLimits
? [
{
name: 'Rate Limits',
key: 'rate-limits',
url: `/project/${ref}/auth/rate-limits`,
items: [],
},
]
: []),
...(authenticationEmails
? [
{
name: 'Emails',
key: 'emails',
pages: ['templates', 'smtp'],
url: `/project/${ref}/auth/templates`,
items: [],
},
]
: []),
...(authenticationMultiFactor
? [
{
name: 'Multi-Factor',
key: 'mfa',
url: `/project/${ref}/auth/mfa`,
items: [],
},
]
: []),
{
name: 'URL Configuration',
key: 'url-configuration',
url: `/project/${ref}/auth/url-configuration`,
items: [],
},
...(authenticationAttackProtection
? [
{
name: 'Attack Protection',
key: 'protection',
url: `/project/${ref}/auth/protection`,
items: [],
},
]
: []),
{
name: 'Auth Hooks',
key: 'hooks',
url: `/project/${ref}/auth/hooks`,
items: [],
label: 'BETA',
},
...(authenticationAdvanced
? [
{
name: 'Advanced',
key: 'advanced',
url: `/project/${ref}/auth/advanced`,
items: [],
},
]
: []),
]
: []),
],
},
]
}