add health benefit form
fix super admin
This commit is contained in:
32
supabase/migrations/20250722110506_super_admin_fix.sql
Normal file
32
supabase/migrations/20250722110506_super_admin_fix.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
grant
|
||||
execute on function medreport.get_account_members (text) to authenticated,
|
||||
service_role;
|
||||
|
||||
create or replace function medreport.is_company_admin(account_slug text)
|
||||
returns boolean
|
||||
set search_path = ''
|
||||
language plpgsql
|
||||
as $$
|
||||
declare
|
||||
is_owner boolean;
|
||||
begin
|
||||
select exists (
|
||||
select 1
|
||||
from medreport.accounts_memberships am
|
||||
join medreport.accounts a on a.id = am.account_id
|
||||
where am.user_id = auth.uid()
|
||||
and am.account_role = 'owner'
|
||||
and a.slug = account_slug
|
||||
) into is_owner;
|
||||
|
||||
return is_owner;
|
||||
end;
|
||||
$$;
|
||||
|
||||
grant execute on function medreport.is_company_admin(text) to authenticated, service_role;
|
||||
|
||||
grant
|
||||
execute on function medreport.team_account_workspace (text) to authenticated,
|
||||
service_role;
|
||||
|
||||
grant execute on function medreport.get_account_invitations(text) to authenticated, service_role;
|
||||
Reference in New Issue
Block a user