Skip to content

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

chore: enable insert

Abdurrahman Rajab488ee2583067
diff --git a/studio/components/interfaces/Auth/Policies/PolicyEditorModal/PolicyEditorModal.constants.ts b/studio/components/interfaces/Auth/Policies/PolicyEditorModal/PolicyEditorModal.constants.ts
index a24711e35e9..fcd6e52a190 100644
--- a/studio/components/interfaces/Auth/Policies/PolicyEditorModal/PolicyEditorModal.constants.ts
+++ b/studio/components/interfaces/Auth/Policies/PolicyEditorModal/PolicyEditorModal.constants.ts
@@ -83,5 +83,21 @@ FOR DELETE USING (
check: '',
command: 'DELETE',
roles: [],
+ }, {
+ id: 'policy-5',
+ templateName: 'Enable insert access for users based on their user ID *',
+ description:
+ 'This policy assumes that your table has a column "user_id", and allows users to insert rows which the "user_id" column matches their ID',
+ statement: `
+CREATE POLICY "policy_name"
+ON ${schema}.${table}
+FOR INSERT USING (
+ auth.uid() = user_id
+);`.trim(),
+ name: 'Enable insert for users based on user_id',
+ definition: 'auth.uid() = user_id',
+ check: '',
+ command: 'INSERT',
+ roles: [],
},
]