add health benefit form

fix super admin
This commit is contained in:
Danel Kungla
2025-07-23 16:33:24 +03:00
parent 2db67b7f20
commit 86b86c6752
43 changed files with 1329 additions and 561 deletions

View 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;