-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: creating a vault after whitelisting a user would make the vault …
…not accessible to the user as the whitelisting would have already happened
- Loading branch information
Showing
15 changed files
with
318 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/api/supabase/migrations/20240121201836_remote_schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
create type "public"."vault_entity_types" as enum ('activity_reward', 'treasury', 'vault', 'custodian', 'kyc_provider'); | ||
|
||
alter table "public"."vault_distribution_entities" alter column "type" set data type vault_entity_types using "type"::text::vault_entity_types; | ||
|
||
drop type "public"."vault_distribution_entity_types"; | ||
|
||
|
35 changes: 35 additions & 0 deletions
35
packages/api/supabase/migrations/20240121202500_remote_schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
drop policy "Enable select for authenticated users only" on "public"."vault_distribution_configs"; | ||
|
||
drop policy "Enable select for authenticated users only" on "public"."vault_distribution_entities"; | ||
|
||
alter table "public"."vault_distribution_configs" add column "tenant" uuid; | ||
|
||
alter table "public"."vault_distribution_entities" add column "tenant" uuid; | ||
|
||
alter table "public"."vault_distribution_configs" add constraint "vault_distribution_configs_tenant_fkey" FOREIGN KEY (tenant) REFERENCES auth.users(id) ON DELETE SET NULL not valid; | ||
|
||
alter table "public"."vault_distribution_configs" validate constraint "vault_distribution_configs_tenant_fkey"; | ||
|
||
alter table "public"."vault_distribution_entities" add constraint "vault_distribution_entities_tenant_fkey" FOREIGN KEY (tenant) REFERENCES auth.users(id) ON DELETE SET NULL not valid; | ||
|
||
alter table "public"."vault_distribution_entities" validate constraint "vault_distribution_entities_tenant_fkey"; | ||
|
||
create policy "Segregate vaults by tenants" | ||
on "public"."vault_distribution_configs" | ||
as permissive | ||
for all | ||
to public | ||
using ((((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) IS NULL) AND (tenant IS NULL)) OR ((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) = 'partner'::text) AND (tenant = auth.uid())))) | ||
with check ((((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) IS NULL) AND (tenant IS NULL)) OR ((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) = 'partner'::text) AND (tenant = auth.uid())))); | ||
|
||
|
||
create policy "Segregate vaults by tenants" | ||
on "public"."vault_distribution_entities" | ||
as permissive | ||
for all | ||
to public | ||
using ((((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) IS NULL) AND (tenant IS NULL)) OR ((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) = 'partner'::text) AND (tenant = auth.uid())))) | ||
with check ((((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) IS NULL) AND (tenant IS NULL)) OR ((((auth.jwt() -> 'app_metadata'::text) ->> 'entity_type'::text) = 'partner'::text) AND (tenant = auth.uid())))); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.