Skip to content

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

Enable read only access to the auth users and templates pages

Joshen Lim1d81965f8386
diff --git a/studio/components/interfaces/Authentication/Templates.tsx b/studio/components/interfaces/Authentication/Templates.tsx
index 04b2b6142ce..681df42e284 100644
--- a/studio/components/interfaces/Authentication/Templates.tsx
+++ b/studio/components/interfaces/Authentication/Templates.tsx
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router'
import { Typography } from '@supabase/ui'
import { AutoField, LongTextField } from 'uniforms-bootstrap4'
-import { API_URL } from 'lib/constants'
+import { API_URL, IS_PLATFORM } from 'lib/constants'
import { useProjectAuthConfig, useStore } from 'hooks'
import { pluckJsonSchemaFields } from 'lib/helpers'
import { patch } from 'lib/common/fetch'
@@ -62,8 +62,9 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="SMS_TEMPLATE"
showInlineError
+ name="SMS_TEMPLATE"
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an sms body."
/>
@@ -83,14 +84,16 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="MAILER_SUBJECTS_CONFIRMATION"
showInlineError
+ name="MAILER_SUBJECTS_CONFIRMATION"
+ readOnly={!IS_PLATFORM}
errorMessage="Please enter a subject."
/>
<LongTextField
+ showInlineError
name="MAILER_TEMPLATES_CONFIRMATION_CONTENT"
rows={6}
- showInlineError
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an email body."
/>
@@ -110,14 +113,16 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="MAILER_SUBJECTS_RECOVERY"
showInlineError
+ name="MAILER_SUBJECTS_RECOVERY"
+ readOnly={!IS_PLATFORM}
errorMessage="Please enter a subject."
/>
<LongTextField
+ showInlineError
name="MAILER_TEMPLATES_RECOVERY_CONTENT"
rows={6}
- showInlineError
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an email body."
/>
@@ -138,14 +143,16 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="MAILER_SUBJECTS_MAGIC_LINK"
showInlineError
+ name="MAILER_SUBJECTS_MAGIC_LINK"
+ readOnly={!IS_PLATFORM}
errorMessage="Please enter a subject."
/>
<LongTextField
+ showInlineError
name="MAILER_TEMPLATES_MAGIC_LINK_CONTENT"
rows={6}
- showInlineError
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an email body."
/>
@@ -166,14 +173,16 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="MAILER_SUBJECTS_EMAIL_CHANGE"
showInlineError
+ name="MAILER_SUBJECTS_EMAIL_CHANGE"
+ readOnly={!IS_PLATFORM}
errorMessage="Please enter a subject."
/>
<LongTextField
+ showInlineError
name="MAILER_TEMPLATES_EMAIL_CHANGE_CONTENT"
rows={6}
- showInlineError
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an email body."
/>
@@ -193,14 +202,16 @@ const Templates: FC<any> = ({ project }) => {
onSubmit={(model: any) => onFormSubmit(model)}
>
<AutoField
- name="MAILER_SUBJECTS_INVITE"
showInlineError
+ name="MAILER_SUBJECTS_INVITE"
+ readOnly={!IS_PLATFORM}
errorMessage="Please enter a subject."
/>
<LongTextField
+ showInlineError
name="MAILER_TEMPLATES_INVITE_CONTENT"
rows={6}
- showInlineError
+ readOnly={!IS_PLATFORM}
inputClassName="font-mono"
errorMessage="Please enter an email body."
/>
diff --git a/studio/components/interfaces/Authentication/Users/Users.tsx b/studio/components/interfaces/Authentication/Users/Users.tsx
index 51bf0dcb764..39ebc652d08 100644
--- a/studio/components/interfaces/Authentication/Users/Users.tsx
+++ b/studio/components/interfaces/Authentication/Users/Users.tsx
@@ -4,16 +4,19 @@ import { observer } from 'mobx-react-lite'
import { Button, Input, IconSearch, IconX } from '@supabase/ui'
import { PageContext } from 'pages/project/[ref]/auth/users'
+import { IS_PLATFORM } from 'lib/constants'
import UsersList from './UsersList'
import InviteUserModal from './InviteUserModal'
const Users = () => {
const PageState: any = useContext(PageContext)
- const inviteEnabled = semver.gte(
- // @ts-ignore
- semver.coerce(PageState.projectKpsVersion || 'kps-v2.5.4'),
- semver.coerce('kps-v2.5.3')
- )
+ const inviteEnabled =
+ IS_PLATFORM &&
+ semver.gte(
+ // @ts-ignore
+ semver.coerce(PageState.projectKpsVersion || 'kps-v2.5.4'),
+ semver.coerce('kps-v2.5.3')
+ )
useEffect(() => {
PageState.fetchData(1)
diff --git a/studio/components/interfaces/Authentication/Users/UsersListItem.tsx b/studio/components/interfaces/Authentication/Users/UsersListItem.tsx
index a504b94094e..8c0e03f084d 100644
--- a/studio/components/interfaces/Authentication/Users/UsersListItem.tsx
+++ b/studio/components/interfaces/Authentication/Users/UsersListItem.tsx
@@ -5,6 +5,7 @@ import { Badge, Typography } from '@supabase/ui'
import Table from 'components/to-be-cleaned/Table'
import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'
+import { IS_PLATFORM } from 'lib/constants'
import UserDropdown from './UserDropdown'
interface Props {
@@ -45,9 +46,7 @@ const UserListItem: FC<Props> = ({ user }) => {
{user.id}
</SimpleCodeBlock>
</Table.td>
- <Table.td className="text-right">
- <UserDropdown user={user} />
- </Table.td>
+ <Table.td className="text-right">{IS_PLATFORM && <UserDropdown user={user} />}</Table.td>
</Table.tr>
)
}
diff --git a/studio/components/layouts/AuthLayout/AuthLayout.utils.ts b/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
index cad98e21b33..7ce9f4e3d68 100644
--- a/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
+++ b/studio/components/layouts/AuthLayout/AuthLayout.utils.ts
@@ -2,31 +2,29 @@ import { IS_PLATFORM } from 'lib/constants'
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
export const generateAuthMenu = (ref: string): ProductMenuGroup[] => {
- if (IS_PLATFORM) {
- return [
- {
- title: 'General',
- items: [
- { name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] },
- { name: 'Policies', key: 'policies', url: `/project/${ref}/auth/policies`, items: [] },
- { name: 'Templates', key: 'templates', url: `/project/${ref}/auth/templates`, items: [] },
- ],
- },
- {
- title: 'Configuration',
- items: [
- { name: 'Settings', key: 'settings', url: `/project/${ref}/auth/settings`, items: [] },
- ],
- },
- ]
- }
-
return [
{
title: 'General',
items: [
+ { name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] },
{ name: 'Policies', key: 'policies', url: `/project/${ref}/auth/policies`, items: [] },
+ { name: 'Templates', key: 'templates', url: `/project/${ref}/auth/templates`, items: [] },
],
},
+ ...(IS_PLATFORM
+ ? [
+ {
+ title: 'Configuration',
+ items: [
+ {
+ name: 'Settings',
+ key: 'settings',
+ url: `/project/${ref}/auth/settings`,
+ items: [],
+ },
+ ],
+ },
+ ]
+ : []),
]
}
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index c5cc61d5596..ef988c39e1a 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -29,7 +29,7 @@ export const generateProductRoutes = (ref: string): Route[] => {
key: 'auth',
label: 'Authentication',
icon: <IconUsers size={18} strokeWidth={2} />,
- link: IS_PLATFORM ? `/project/${ref}/auth/users` : `/project/${ref}/auth/policies`,
+ link: `/project/${ref}/auth/users`,
},
...(IS_PLATFORM
? [