Skip to content

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

Prefill bucket id when creating a full custom policy for storage for that bucket

Joshen Lim96801fd67262
diff --git a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditPolicyModal.js b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditPolicyModal.js
index a0d94825192..5d017de6952 100644
--- a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditPolicyModal.js
+++ b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditPolicyModal.js
@@ -50,7 +50,15 @@ const StoragePoliciesEditPolicyModal = ({
/* Methods to determine which step to show */
const onViewIntro = () => setView(POLICY_MODAL_VIEWS.SELECTION)
- const onViewEditor = () => setView(POLICY_MODAL_VIEWS.EDITOR)
+ const onViewEditor = (state) => {
+ if (state === 'new') {
+ setPolicyFormFields({
+ ...policyFormFields,
+ definition: `bucket_id = '${bucketName}'`,
+ })
+ }
+ setView(POLICY_MODAL_VIEWS.EDITOR)
+ }
const onViewTemplates = () => {
setPreviousView(view)
setView(POLICY_MODAL_VIEWS.TEMPLATES)
@@ -211,7 +219,7 @@ const StoragePoliciesEditPolicyModal = ({
<PolicySelection
description="PostgreSQL policies control access to your files and folders"
onViewTemplates={onViewTemplates}
- onViewEditor={onViewEditor}
+ onViewEditor={() => onViewEditor('new')}
/>
) : view === POLICY_MODAL_VIEWS.EDITOR ? (
<StoragePoliciesEditor