Click here to see an example `psql` interaction using this.
+ +This example shows that the `public.profiles` table from the tutorial example can indeed be updated by the `postgres` role and the owner of the row but not from `anon` connections: + +```shell +postgres=> select id, email from auth.users; + id | email +--------------------------------------+------------------- + d4f0aa86-e6f6-41d1-bd32-391f077cf1b9 | user1@example.com + 15d6811a-16ee-4fa2-9b18-b63085688be4 | user2@example.com + 4e1010bb-eb37-4a4d-a05a-b0ee315c9d56 | user3@example.com +(3 rows) + +postgres=> table public.profiles; + id | updated_at | username | full_name | avatar_url | website +--------------------------------------+------------+----------+-----------+------------+--------- + d4f0aa86-e6f6-41d1-bd32-391f077cf1b9 | | user1 | User 1 | | + 15d6811a-16ee-4fa2-9b18-b63085688be4 | | user2 | User 2 | | + 4e1010bb-eb37-4a4d-a05a-b0ee315c9d56 | | user3 | User 3 | | +(3 rows) + +postgres=> call auth.login_as_anon(); +CALL +postgres=> update public.profiles set updated_at=now(); +UPDATE 0 -- anon users cannot update any profile but see all of them +postgres=> table public.profiles; + id | updated_at | username | full_name | avatar_url | website +--------------------------------------+------------+----------+-----------+------------+--------- + d4f0aa86-e6f6-41d1-bd32-391f077cf1b9 | | user1 | User 1 | | + 15d6811a-16ee-4fa2-9b18-b63085688be4 | | user2 | User 2 | | + 4e1010bb-eb37-4a4d-a05a-b0ee315c9d56 | | user3 | User 3 | | +(3 rows) + +postgres=> call auth.logout(); +CALL +postgres=> call auth.login_as_user('user1@example.com'); +NOTICE: set role authenticated; -- logging in as 'd4f0aa86-e6f6-41d1-bd32-391f077cf1b9' ('user1@example.com') +CALL +postgres=> update public.profiles set updated_at=now(); +UPDATE 1 -- authenticated users can update their own profile and see all of them +postgres=> table public.profiles; + id | updated_at | username | full_name | avatar_url | website +--------------------------------------+-------------------------------+----------+-----------+------------+--------- + 15d6811a-16ee-4fa2-9b18-b63085688be4 | | user1 | User 1 | | + 4e1010bb-eb37-4a4d-a05a-b0ee315c9d56 | | user2 | User 2 | | + d4f0aa86-e6f6-41d1-bd32-391f077cf1b9 | 2023-02-18 21:39:16.204612+00 | user3 | User 3 | | +(3 rows) + +postgres=> call auth.logout(); +CALL +postgres=> update public.profiles set updated_at=now(); +UPDATE 3 -- the 'postgres' role can update and see all profiles +postgres=> table public.profiles; + id | updated_at | username | full_name | avatar_url | website +--------------------------------------+-------------------------------+----------+-----------+------------+--------- + 15d6811a-16ee-4fa2-9b18-b63085688be4 | 2023-02-18 21:40:08.216324+00 | user1 | User 1 | | + 4e1010bb-eb37-4a4d-a05a-b0ee315c9d56 | 2023-02-18 21:40:08.216324+00 | user2 | User 2 | | + d4f0aa86-e6f6-41d1-bd32-391f077cf1b9 | 2023-02-18 21:40:08.216324+00 | user3 | User 3 | | +(3 rows) + +``` + +Supabase + Vue 3
Sign in via magic link with your email below
diff --git a/studio/components/interfaces/Database/Roles/RolesList.tsx b/studio/components/interfaces/Database/Roles/RolesList.tsx
index 956fb1af75..c5059c26e0 100644
--- a/studio/components/interfaces/Database/Roles/RolesList.tsx
+++ b/studio/components/interfaces/Database/Roles/RolesList.tsx
@@ -1,17 +1,18 @@
+import { partition } from 'lodash'
import { FC, useState, useEffect } from 'react'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
import { PostgresRole } from '@supabase/postgres-meta'
import { Button, Input, IconPlus, IconSearch, IconX, Badge } from 'ui'
+import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { useStore } from 'hooks'
+import { checkPermissions, useStore } from 'hooks'
import SparkBar from 'components/ui/SparkBar'
import { FormHeader } from 'components/ui/Forms'
import RoleRow from './RoleRow'
-import DeleteRoleModal from './DeleteRoleModal'
import { SUPABASE_ROLES } from './Roles.constants'
-import { partition } from 'lodash'
import CreateRolePanel from './CreateRolePanel'
+import DeleteRoleModal from './DeleteRoleModal'
interface Props {
onSelectRole: (role: any) => void
@@ -26,6 +27,8 @@ const RolesList: FC