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 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
),