Sigra.Admin.Authorizer (Sigra v0.2.3)

Copy Markdown View Source

Direct-path admin authorization helpers for exports, mutations, and queries.

These helpers operate on a resolved Sigra.Admin.Scope so code outside the router and LiveView entry points can still enforce the same global-vs-org contract.

Summary

Functions

authorize_global!(admin_scope)

@spec authorize_global!(Sigra.Admin.Scope.t()) :: :ok

authorize_impersonation_target!(admin_scope, target_user)

@spec authorize_impersonation_target!(Sigra.Admin.Scope.t(), map() | struct()) :: :ok

authorize_organization!(admin_scope, organization_or_id)

@spec authorize_organization!(Sigra.Admin.Scope.t(), map() | binary()) :: :ok

scope_query(queryable, admin_scope)

@spec scope_query(Ecto.Queryable.t(), Sigra.Admin.Scope.t()) :: Ecto.Query.t()