Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add flag to hide email and phone columns in auth users (#39151)

Joshen Lim843234e153ad
diff --git a/apps/studio/components/interfaces/Auth/Users/Users.utils.tsx b/apps/studio/components/interfaces/Auth/Users/Users.utils.tsx
index 92c05be3e02..ca935717c1d 100644
--- a/apps/studio/components/interfaces/Auth/Users/Users.utils.tsx
+++ b/apps/studio/components/interfaces/Auth/Users/Users.utils.tsx
@@ -15,7 +15,7 @@ import {
copyToClipboard,
} from 'ui'
import { PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'
-import { ColumnConfiguration, USERS_TABLE_COLUMNS } from './Users.constants'
+import { ColumnConfiguration, UsersTableColumn } from './Users.constants'
import { HeaderCell } from './UsersGridComponents'
const GITHUB_AVATAR_URL = 'https://avatars.githubusercontent.com'
@@ -250,21 +250,23 @@ export function getAvatarUrl(user: User): string | undefined {
}
export const formatUserColumns = ({
+ columns,
config,
users,
visibleColumns = [],
setSortByValue,
onSelectDeleteUser,
}: {
+ columns: UsersTableColumn[]
config: ColumnConfiguration[]
users: User[]
visibleColumns?: string[]
setSortByValue: (val: string) => void
onSelectDeleteUser: (user: User) => void
}) => {
- const columnOrder = config.map((c) => c.id) ?? USERS_TABLE_COLUMNS.map((c) => c.id)
+ const columnOrder = config.map((c) => c.id) ?? columns.map((c) => c.id)
- let gridColumns = USERS_TABLE_COLUMNS.map((col) => {
+ let gridColumns = columns.map((col) => {
const savedConfig = config.find((c) => c.id === col.id)
const res: Column<any> = {
key: col.id,
diff --git a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
index d1564757727..6570110caf0 100644
--- a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
+++ b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
@@ -86,13 +86,25 @@ export const UsersV2 = () => {
authenticationShowSortByEmail: showSortByEmail,
authenticationShowSortByPhone: showSortByPhone,
authenticationShowUserTypeFilter: showUserTypeFilter,
+ authenticationShowEmailPhoneColumns: showEmailPhoneColumns,
} = useIsFeatureEnabled([
'authentication:show_provider_filter',
'authentication:show_sort_by_email',
'authentication:show_sort_by_phone',
'authentication:show_user_type_filter',
+ 'authentication:show_email_phone_columns',
])
+ const userTableColumns = useMemo(() => {
+ if (showEmailPhoneColumns) return USERS_TABLE_COLUMNS
+ else {
+ return USERS_TABLE_COLUMNS.filter((col) => {
+ if (col.id === 'email' || col.id === 'phone') return false
+ return true
+ })
+ }
+ }, [showEmailPhoneColumns])
+
const [columns, setColumns] = useState<Column<any>[]>([])
const [search, setSearch] = useState('')
const [filter, setFilter] = useState<Filter>('all')
@@ -265,6 +277,7 @@ export const UsersV2 = () => {
(isErrorStorage && (errorStorage as Error).message.includes('data is undefined')))
) {
const columns = formatUserColumns({
+ columns: userTableColumns,
config: columnConfiguration ?? [],
users: users ?? [],
visibleColumns: selectedColumns,
@@ -272,7 +285,7 @@ export const UsersV2 = () => {
onSelectDeleteUser: setSelectedUserToDelete,
})
setColumns(columns)
- if (columns.length < USERS_TABLE_COLUMNS.length) {
+ if (columns.length < userTableColumns.length) {
setSelectedColumns(columns.filter((col) => col.key !== 'img').map((col) => col.key))
}
}
@@ -386,7 +399,7 @@ export const UsersV2 = () => {
name={selectedColumns.length === 0 ? 'All columns' : 'Columns'}
title="Select columns to show"
buttonType={selectedColumns.length === 0 ? 'dashed' : 'default'}
- options={USERS_TABLE_COLUMNS.slice(1)} // Ignore user image column
+ options={userTableColumns.slice(1)} // Ignore user image column
labelKey="name"
valueKey="id"
labelClass="text-xs"
@@ -401,19 +414,20 @@ export const UsersV2 = () => {
let updatedConfig = (columnConfiguration ?? []).slice()
if (value.length === 0) {
- updatedConfig = USERS_TABLE_COLUMNS.map((c) => ({ id: c.id, width: c.width }))
+ updatedConfig = userTableColumns.map((c) => ({ id: c.id, width: c.width }))
} else {
value.forEach((col) => {
const hasExisting = updatedConfig.find((c) => c.id === col)
if (!hasExisting)
updatedConfig.push({
id: col,
- width: USERS_TABLE_COLUMNS.find((c) => c.id === col)?.width,
+ width: userTableColumns.find((c) => c.id === col)?.width,
})
})
}
const updatedColumns = formatUserColumns({
+ columns: userTableColumns,
config: updatedConfig,
users: users ?? [],
visibleColumns: value,
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index 3ecd75981cf..6bef25c14fc 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -14,14 +14,15 @@
"authentication:attack_protection": true,
"authentication:advanced": true,
- "authentication:show_providers": true,
+
+ "authentication:show_email_phone_columns": true,
"authentication:show_manual_linking": true,
- "authentication:show_send_invitation": true,
"authentication:show_provider_filter": true,
+ "authentication:show_providers": true,
+ "authentication:show_send_invitation": true,
"authentication:show_sort_by_email": true,
"authentication:show_sort_by_phone": true,
"authentication:show_user_type_filter": true,
-
"billing:all": true,
"dashboard_auth:sign_up": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index e678d317abc..3ee59127865 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -80,6 +80,10 @@
"type": "boolean",
"description": "Show the user type filter in the authentication users page"
},
+ "authentication:show_email_phone_columns": {
+ "type": "boolean",
+ "description": "Show the email and phone columns in the authentication users page"
+ },
"billing:all": {
"type": "boolean",
@@ -366,20 +370,21 @@
"ai:opt_in_level_schema",
"ai:opt_in_level_schema_and_log",
"ai:opt_in_level_schema_and_log_and_data",
- "authentication:sign_in_providers",
- "authentication:third_party_auth",
- "authentication:rate_limits",
+ "authentication:advanced",
+ "authentication:attack_protection",
"authentication:emails",
"authentication:multi_factor",
- "authentication:attack_protection",
- "authentication:advanced",
- "authentication:show_providers",
+ "authentication:rate_limits",
+ "authentication:show_email_phone_columns",
"authentication:show_manual_linking",
"authentication:show_provider_filter",
+ "authentication:show_providers",
"authentication:show_send_invitation",
"authentication:show_sort_by_email",
"authentication:show_sort_by_phone",
"authentication:show_user_type_filter",
+ "authentication:sign_in_providers",
+ "authentication:third_party_auth",
"billing:all",
"dashboard_auth:sign_up",
"dashboard_auth:sign_in_with_github",