From 53b049173424f19dae2c8b321e60bd3b2077a61c Mon Sep 17 00:00:00 2001 From: Crispy <12525875+Crispy1975@users.noreply.github.com> Date: Thu, 21 Aug 2025 00:00:51 +0100 Subject: [PATCH 1/2] fix: label r2np correctly as it is a beta product (#38079) --- .../interfaces/Database/Backups/DatabaseBackupsNav.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/studio/components/interfaces/Database/Backups/DatabaseBackupsNav.tsx b/apps/studio/components/interfaces/Database/Backups/DatabaseBackupsNav.tsx index 19e115c528a3f..6c4561ad1eba0 100644 --- a/apps/studio/components/interfaces/Database/Backups/DatabaseBackupsNav.tsx +++ b/apps/studio/components/interfaces/Database/Backups/DatabaseBackupsNav.tsx @@ -30,7 +30,7 @@ function DatabaseBackupsNav({ active }: Props) {
Restore to new project{' '} - New + Beta
), From 07dfb9a542f06629cbe465be9b96bfdeb6fef849 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Date: Thu, 21 Aug 2025 11:05:51 +1200 Subject: [PATCH 2/2] docs(realtime): JWT claims can be accessed when authorising channels (#38049) --- .../content/guides/realtime/authorization.mdx | 21 +++++++++++++++---- .../content/guides/realtime/broadcast.mdx | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/docs/content/guides/realtime/authorization.mdx b/apps/docs/content/guides/realtime/authorization.mdx index 66c854efcb768..3dd1d59b33635 100644 --- a/apps/docs/content/guides/realtime/authorization.mdx +++ b/apps/docs/content/guides/realtime/authorization.mdx @@ -50,13 +50,11 @@ Increased RLS complexity can impact database performance and connection time, le -## Helper functions - -You can use the following helper functions when writing RLS policies: +## Accessing request information ### `realtime.topic` -Returns the Channel topic the user is attempting to connect to. +You can use the `realtime.topic` helper function when writing RLS policies. It returns the Channel topic the user is attempting to connect to. ```sql create policy "authenticated can read all messages on topic" @@ -68,6 +66,21 @@ using ( ); ``` +### JWT claims + +The user claims can be accessed using the `current_setting` function. The claims are available as a JSON object in the `request.jwt.claims` setting. + +```sql +create policy "authenticated with supabase.io email can read all" +on "realtime"."messages" +for select +to authenticated +using ( + -- Only users with the email claim ending with @supabase.io + (((current_setting('request.jwt.claims'))::json ->> 'email') ~~ '%@supabase.io') +); +``` + ## Examples The following examples use this schema: diff --git a/apps/docs/content/guides/realtime/broadcast.mdx b/apps/docs/content/guides/realtime/broadcast.mdx index fec239f875df5..18bce67996743 100644 --- a/apps/docs/content/guides/realtime/broadcast.mdx +++ b/apps/docs/content/guides/realtime/broadcast.mdx @@ -811,7 +811,7 @@ The `realtime.send` function provides the most flexibility by allowing you to br ```sql SELECT realtime.send ( - to_jsonb ('{}'::text), -- JSONB Payload + '{}'::jsonb, -- JSONB Payload 'event', -- Event name 'topic', -- Topic FALSE -- Public / Private flag