Update test cases and improve account actioning

This commit refactors Supabase test cases to reflect the updated account actioning mechanism. The "makerkit.get_user_id" function calls were replaced with the new "tests.get_supabase_uid" function, aligning with the testing structure update. It also introduces new policies which further refine user role actions with more precise checks, replacing the old 'delete' policy with the more comprehensive 'can_action_account_member' function. New test cases for updating memberships and deleting memberships have also been added.
This commit is contained in:
giancarlo
2024-04-20 23:22:18 +08:00
parent a55655a61a
commit f7fe67f7f7
8 changed files with 192 additions and 94 deletions

View File

@@ -15,6 +15,8 @@ create or replace function makerkit.set_identifier(
user_email text
)
returns text
security definer
set search_path = auth, pg_temp
as $$
begin
update auth.users set raw_user_meta_data = jsonb_build_object('test_identifier', identifier)
@@ -65,25 +67,6 @@ end;
$$ language PLPGSQL;
create or replace function makerkit.get_user_id(
user_email text
)
returns uuid
as $$
begin
return
(select
primary_owner_user_id
from
accounts
where
email = user_email);
end;
$$ language PLPGSQL;
begin;
select plan(1);