From 3d69babaf532022679b2faba440644910b7f2c84 Mon Sep 17 00:00:00 2001 From: lorinjameson Date: Thu, 11 Jul 2024 14:48:57 -0400 Subject: [PATCH 1/2] Fix for missing base layer --- SQL Scripts/policies/layer_contexts.sql | 2 +- .../20240711184827_fixing_read_only_base_layer.sql | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 supabase/migrations/20240711184827_fixing_read_only_base_layer.sql diff --git a/SQL Scripts/policies/layer_contexts.sql b/SQL Scripts/policies/layer_contexts.sql index 985b42f..c7d0605 100644 --- a/SQL Scripts/policies/layer_contexts.sql +++ b/SQL Scripts/policies/layer_contexts.sql @@ -5,7 +5,7 @@ CREATE POLICY "Users with correct policies can SELECT on layer_contexts" ON publ is_archived IS FALSE AND ( public.check_action_policy_organization(auth.uid(), 'layer_contexts', 'SELECT') OR public.check_action_policy_project_from_context(auth.uid(), 'layer_contexts', 'SELECT', context_id) OR - public.check_action_policy_layer(auth.uid(), 'layer_contexts', 'SELECT', layer_id) + public.check_action_policy_layer_select(auth.uid(), 'layer_contexts', layer_id) ) ); diff --git a/supabase/migrations/20240711184827_fixing_read_only_base_layer.sql b/supabase/migrations/20240711184827_fixing_read_only_base_layer.sql new file mode 100644 index 0000000..99df354 --- /dev/null +++ b/supabase/migrations/20240711184827_fixing_read_only_base_layer.sql @@ -0,0 +1,11 @@ +drop policy "Users with correct policies can SELECT on layer_contexts" on "public"."layer_contexts"; + +create policy "Users with correct policies can SELECT on layer_contexts" +on "public"."layer_contexts" +as permissive +for select +to authenticated +using (((is_archived IS FALSE) AND (check_action_policy_organization(auth.uid(), 'layer_contexts'::character varying, 'SELECT'::operation_types) OR check_action_policy_project_from_context(auth.uid(), 'layer_contexts'::character varying, 'SELECT'::operation_types, context_id) OR check_action_policy_layer_select(auth.uid(), 'layer_contexts'::character varying, layer_id)))); + + + From e36c7ec607688cea46b36f1943f604845c882986 Mon Sep 17 00:00:00 2001 From: lorinjameson Date: Tue, 16 Jul 2024 14:38:05 -0400 Subject: [PATCH 2/2] Added testing app --- test-email-signup.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test-email-signup.js diff --git a/test-email-signup.js b/test-email-signup.js new file mode 100644 index 0000000..429478a --- /dev/null +++ b/test-email-signup.js @@ -0,0 +1,17 @@ +const Supa = require('@supabase/supabase-js'); + +const EMAIL = 'lorin+invite1@performantsoftware.com'; + +const main = async () => { + const supabase = await Supa.createClient(process.env.SUPABASE_TEST_HOST, process.env.SUPABASE_TEST_SERVICE_KEY); + + const inviteResp = await supabase.auth.admin.inviteUserByEmail(EMAIL); + + if (inviteResp.error) { + console.log('Failed to invite user ', EMAIL); + } else { + console.log('Success!!'); + } +} + +main(); \ No newline at end of file