Add is_archiver db helper function

This commit is contained in:
Jared Schoeny 2025-12-02 00:13:33 -10:00
parent a113d8fa98
commit b3d43e4e50
2 changed files with 13 additions and 0 deletions

View File

@ -349,6 +349,7 @@ export type Database = {
get_my_claim: { Args: { claim: string }; Returns: Json }
get_my_claims: { Args: never; Returns: Json }
is_admin: { Args: never; Returns: boolean }
is_archiver: { Args: never; Returns: boolean }
is_claims_admin: { Args: never; Returns: boolean }
set_claim: {
Args: { claim: string; uid: string; value: Json }

View File

@ -0,0 +1,12 @@
CREATE OR REPLACE FUNCTION public.is_archiver()
RETURNS boolean
LANGUAGE sql
STABLE
AS $function$
select
coalesce(get_my_claim('archiver')::bool,false)
or
coalesce(get_my_claim('claims_admin')::bool,false)
$function$
;