Skip to content

resolveOwnerOrAdminAccess

resolveOwnerOrAdminAccess(claims, options?): OwnerOrAdminAccess

Defined in: packages/contracts/src/supabase-rls.ts:317

The caller’s owner-or-admin standing, resolved from the JWT claims — the JS mirror of the policy’s admin EXISTS and its subject comparison. admin is true when the roles array at adminRolesClaimPath (app_metadata.roles by default — the very array buildSupabaseOwnerOrAdminNativePolicies renders its -> 'seg' chain from, so the two surfaces read one declaration) contains adminRoleName; subject is the sub claim when it is a non-empty string, else null.

Claims arrive unverified in shape, so this never throws: a missing/non-object claims bag, a non-array roles, or non-string members simply confer nothing.

{[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | null

OwnerOrAdminAccessOptions = {}

OwnerOrAdminAccess