Versions in this module Expand all Collapse all v4 v4.0.0 Jul 11, 2026 Changes in this version + func ApplyScope(filters map[string]any, scope Scope) map[string]any + func MaskFields(input map[string]any, denied []string) map[string]any + func ProjectFields(input map[string]any, allowed []string) map[string]any + func Require(ctx context.Context, auth Authorizer, subject any, action string, resource any) error + func RequireOwner(subjectID string, resource Owner) error + func RequireOwnerID(subjectID, ownerID string) error + func RequireTenant(tenantID string, resource TenantOwned) error + func TenantIDFromContext(ctx context.Context) (string, bool) + func WithActor(ctx context.Context, actor Actor) context.Context + func WithScope(ctx context.Context, scope Scope) context.Context + type Actor struct + UserID string + func ActorFromContext(ctx context.Context) (Actor, bool) + type AllowlistAuthorizer struct + func NewAllowlistAuthorizer() *AllowlistAuthorizer + func (a *AllowlistAuthorizer) Allow(action string, auth Authorizer) error + func (a *AllowlistAuthorizer) AllowAny(action string) error + func (a *AllowlistAuthorizer) AllowFunc(action string, fn AuthorizerFunc) error + func (a *AllowlistAuthorizer) Can(ctx context.Context, subject any, action string, resource any) error + type Authorizer interface + Can func(ctx context.Context, subject any, action string, resource any) error + type AuthorizerFunc func(ctx context.Context, subject any, action string, resource any) error + func (f AuthorizerFunc) Can(ctx context.Context, subject any, action string, resource any) error + type Owner interface + OwnerID func() string + type PolicyAuthorizer struct + func NewPolicyAuthorizer(engine PolicyEngine, opts PolicyAuthorizerOptions) *PolicyAuthorizer + func (p *PolicyAuthorizer) Can(ctx context.Context, subject any, action string, resource any) error + type PolicyAuthorizerOptions struct + ContextProvider PolicyContextProvider + DenyOnError bool + type PolicyContextProvider func(ctx context.Context) any + type PolicyDecision struct + Allow bool + Data any + Reason string + type PolicyEngine interface + Evaluate func(ctx context.Context, req PolicyRequest) (PolicyDecision, error) + type PolicyRequest struct + Action string + Context any + Resource any + Subject any + type Scope struct + TenantID string + UserID string + func ScopeFromContext(ctx context.Context) (Scope, bool) + func (s Scope) Filters() map[string]any + type TenantOwned interface + TenantID func() string Other modules containing this package github.com/aatuh/api-toolkit/v2 github.com/aatuh/api-toolkit/v3