The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Update abac perms checking for removing mfa factors
Joshen Lim5e6014c46ab7
diff --git a/studio/components/interfaces/Auth/Users/UserDropdown.tsx b/studio/components/interfaces/Auth/Users/UserDropdown.tsxindex 08e4b0e2c92..42dd95b7444 100644--- a/studio/components/interfaces/Auth/Users/UserDropdown.tsx+++ b/studio/components/interfaces/Auth/Users/UserDropdown.tsx@@ -14,9 +14,10 @@ import { User } from './Users.types'interface Props {user: UsercanRemoveUser: boolean+ canRemoveMFAFactors: boolean}-const UserDropdown: FC<Props> = ({ user, canRemoveUser }) => {+const UserDropdown: FC<Props> = ({ user, canRemoveUser, canRemoveMFAFactors }) => {const showDeleteFactorsDropdown = useFlag('mfaSso')const PageState: any = useContext(PageContext)const { ui } = useStore()@@ -175,7 +176,7 @@ const UserDropdown: FC<Props> = ({ user, canRemoveUser }) => {<Dropdown.ItemonClick={handleDeleteFactors}icon={<IconShieldOff size="tiny" />}- disabled={!canRemoveUser}+ disabled={!canRemoveMFAFactors}>Remove MFA factors</Dropdown.Item>@@ -184,7 +185,7 @@ const UserDropdown: FC<Props> = ({ user, canRemoveUser }) => {[Joshen] Deleting MFA factors should be different ABAC perms i thinkneed to double check with KM / anyone familiar with ABAC*/}- {!canRemoveUser && (+ {!canRemoveMFAFactors && (<Tooltip.Content side="bottom"><Tooltip.Arrow className="radix-tooltip-arrow" /><divdiff --git a/studio/components/interfaces/Auth/Users/UsersList.tsx b/studio/components/interfaces/Auth/Users/UsersList.tsxindex e5cbd141394..cd583dd76c3 100644--- a/studio/components/interfaces/Auth/Users/UsersList.tsx+++ b/studio/components/interfaces/Auth/Users/UsersList.tsx@@ -11,7 +11,13 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'const UsersList = ({}) => {const PageState: any = useContext(PageContext)++ // Check once on the top level, rather than checking for every rowconst canRemoveUser = checkPermissions(PermissionAction.TENANT_SQL_DELETE, 'auth.users')+ const canRemoveMFAFactors = checkPermissions(+ PermissionAction.TENANT_SQL_DELETE,+ 'auth.mfa_factors'+ )return (<Loading active={PageState.usersLoading}>@@ -49,7 +55,12 @@ const UsersList = ({}) => {)}{PageState.users.length > 0 &&PageState.users.map((x: any) => (- <UserListItem key={x.id} user={x} canRemoveUser={canRemoveUser} />+ <UserListItem+ key={x.id}+ user={x}+ canRemoveUser={canRemoveUser}+ canRemoveMFAFactors={canRemoveMFAFactors}+ />))}<Table.tr><Table.td colSpan={7}>diff --git a/studio/components/interfaces/Auth/Users/UsersListItem.tsx b/studio/components/interfaces/Auth/Users/UsersListItem.tsxindex 43a6ec57d89..7ae8c894989 100644--- a/studio/components/interfaces/Auth/Users/UsersListItem.tsx+++ b/studio/components/interfaces/Auth/Users/UsersListItem.tsx@@ -11,9 +11,10 @@ import { User } from './Users.types'interface Props {user: UsercanRemoveUser: boolean+ canRemoveMFAFactors: boolean}-const UserListItem: FC<Props> = ({ user, canRemoveUser }) => {+const UserListItem: FC<Props> = ({ user, canRemoveUser, canRemoveMFAFactors }) => {const isUserConfirmed = user.email_confirmed_at || user.phone_confirmed_atconst createdAt = getDateFromIsoString(user.created_at)const lastSignedIn = getDateFromIsoString(user.last_sign_in_at)@@ -54,7 +55,11 @@ const UserListItem: FC<Props> = ({ user, canRemoveUser }) => {</div></Table.td><Table.td className="text-right">- <UserDropdown user={user} canRemoveUser={canRemoveUser} />+ <UserDropdown+ user={user}+ canRemoveUser={canRemoveUser}+ canRemoveMFAFactors={canRemoveMFAFactors}+ /></Table.td></Table.tr>)