accountquery

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package accountquery provides the module-owned account investigation port.

Index

Constants

View Source
const Capability = Domain + ".account-query"
View Source
const Domain = "resources"
View Source
const SensitiveCapability = ""

Variables

View Source
var ErrForbidden = errors.New("account_query_forbidden")
View Source
var ErrInvalid = errors.New("invalid_account_query")
View Source
var ErrUnavailable = errors.New("account_query_unavailable")

Functions

This section is empty.

Types

type Audit

type Audit struct {
	Actor                Principal
	RequestID, Purpose   string
	Scope                Scope
	Targets              []string
	Category, Capability string
	Result               string
	Count                int
	At                   time.Time
	Scopes               []Scope
}

type Auditor

type Auditor interface {
	Record(context.Context, Audit) error
}

Record commits the disclosure audit before any sensitive result is returned.

type Authorizer

type Authorizer interface {
	Scopes(context.Context, Principal, string) ([]Scope, error)
}

Scopes must consult current trusted identity and grants for exactly capability. Empty grants mean forbidden. An adapter must never substitute another domain.

type Field

type Field struct {
	Name, Category, Value string
	Masked                bool
}

type Principal

type Principal struct{ Issuer, Subject string }

func Parse

func Parse(key string) (Principal, error)

func (Principal) Key

func (p Principal) Key() string

func (Principal) Valid

func (p Principal) Valid() bool

type Query

type Query struct {
	Kind, Value string
	Scope       Scope
	Fields      []string
	Purpose     string
	RequestID   string
	Limit       int
	After       string
}

func (Query) GoString

func (q Query) GoString() string

func (Query) String

func (Query) String() string

type Record

type Record struct {
	ID, Subject string
	Scope       Scope
	Source      string
	Current     bool
	ChangedAt   time.Time
	Fields      []Field
}

type Repository

type Repository interface {
	ReadAccount(context.Context, Selection) ([]Record, error)
}

type Scope

type Scope struct {
	School string `json:"school"`
	Group  string `json:"group"`
	Module string `json:"module"`
}

func (Scope) Contains

func (s Scope) Contains(t Scope) bool

func (Scope) Valid

func (s Scope) Valid() bool

type Selection

type Selection struct {
	Query                   Query
	Scopes, SensitiveScopes []Scope
}

type Service

type Service struct {
	Repo  Repository
	Auth  Authorizer
	Audit Auditor
	Now   func() time.Time
}

func (Service) Query

func (s Service) Query(ctx context.Context, p Principal, q Query) ([]Record, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL