The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix filtering on SAML provider (#29636)
Joshen Lim3bcbd9cae514
diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsxindex 5f051bfc438..753baf9d8e2 100644--- a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx+++ b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx@@ -1383,7 +1383,7 @@ const PROVIDER_SAML = {$schema: JSON_SCHEMA_VERSION,type: 'object',title: 'SAML 2.0',- link: 'https://supabase.com/docs/guides/auth/enterprise-sso',+ link: 'https://supabase.com/docs/guides/auth/enterprise-sso/auth-sso-saml',properties: {SAML_ENABLED: {title: 'Enable SAML 2.0 Single Sign-on',diff --git a/apps/studio/data/auth/users-count-query.ts b/apps/studio/data/auth/users-count-query.tsindex a85e80cbbda..1051154f9c8 100644--- a/apps/studio/data/auth/users-count-query.ts+++ b/apps/studio/data/auth/users-count-query.ts@@ -41,9 +41,17 @@ const getUsersCountSQl = ({}if (providers && providers.length > 0) {- conditions.push(- `(raw_app_meta_data->>'providers')::jsonb ?| array[${providers.map((p) => `'${p}'`).join(', ')}]`- )+ // [Joshen] This is arguarbly not fully optimized, but at the same time not commonly used+ // JFYI in case we do eventually run into performance issues here when filtering for SAML provider+ if (providers.includes('saml 2.0')) {+ conditions.push(+ `(select jsonb_agg(case when value ~ '^sso' then 'sso' else value end) from jsonb_array_elements_text((raw_app_meta_data ->> 'providers')::jsonb)) ?| array[${providers.map((p) => (p === 'saml 2.0' ? `'sso'` : `'${p}'`)).join(', ')}]`.trim()+ )+ } else {+ conditions.push(+ `(raw_app_meta_data->>'providers')::jsonb ?| array[${providers.map((p) => `'${p}'`).join(', ')}]`+ )+ }}const combinedConditions = conditions.map((x) => `(${x})`).join(' and ')diff --git a/apps/studio/data/auth/users-infinite-query.ts b/apps/studio/data/auth/users-infinite-query.tsindex 95e98727aaa..91b2003ccfb 100644--- a/apps/studio/data/auth/users-infinite-query.ts+++ b/apps/studio/data/auth/users-infinite-query.ts@@ -56,9 +56,17 @@ const getUsersSQL = ({}if (providers && providers.length > 0) {- conditions.push(- `(raw_app_meta_data->>'providers')::jsonb ?| array[${providers.map((p) => `'${p}'`).join(', ')}]`- )+ // [Joshen] This is arguarbly not fully optimized, but at the same time not commonly used+ // JFYI in case we do eventually run into performance issues here when filtering for SAML provider+ if (providers.includes('saml 2.0')) {+ conditions.push(+ `(select jsonb_agg(case when value ~ '^sso' then 'sso' else value end) from jsonb_array_elements_text((raw_app_meta_data ->> 'providers')::jsonb)) ?| array[${providers.map((p) => (p === 'saml 2.0' ? `'sso'` : `'${p}'`)).join(', ')}]`.trim()+ )+ } else {+ conditions.push(+ `(raw_app_meta_data->>'providers')::jsonb ?| array[${providers.map((p) => `'${p}'`).join(', ')}]`+ )+ }}const combinedConditions = conditions.map((x) => `(${x})`).join(' and ')