auth/role_grant_queries.ts view source
(deps: QueryDeps, account_id: string, role: string): Promise<boolean> Account-grain check: does any actor on account_id hold an active
global role_grant for role?
Symmetric with query_role_grant_has_role but keyed on the account
instead of a single actor — for surfaces with auth: actor: 'none'
that don't load auth.role_grants and can't use the in-memory
has_scoped_role predicate. Joins role_grant → actor; matches
only global role_grants (scope_id IS NULL) since the use case is
"is the caller's account broadly admin", not scope-aware.
Fast under the existing idx_role_grant_actor index — the inner
actor_id IN (...) subquery is index-scan, and the outer EXISTS
stops at the first match.
deps
query dependencies
account_id
the account to check
stringrole
the role to check for (e.g. ROLE_ADMIN)
stringreturns
Promise<boolean> true if any actor on the account has an active global role_grant for role