subjects

package
v0.22.4 Latest Latest
Warning

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

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

Documentation

Overview

Package subjects lists the entities evidence can name as its subject: defined components, SSP system components, parties and users.

Index

Constants

View Source
const MaxLookupIDs = 100

MaxLookupIDs is the most subjects one lookup by ID may name: one page at the largest page size.

Variables

AllKinds lists every subject kind, in the order they're searched.

Functions

This section is empty.

Types

type IdentityLabel

type IdentityLabel struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

IdentityLabel is one identity label of a defined component.

type Kind

type Kind string

Kind is the kind of entity a subject is.

const (
	KindDefinedComponent Kind = "defined-component"
	KindSystemComponent  Kind = "system-component"
	KindParty            Kind = "party"
	KindUser             Kind = "user"
)

func ParseKind

func ParseKind(value string) (Kind, bool)

ParseKind returns the Kind named by value, if there is one.

type LinkedSSP

type LinkedSSP struct {
	SSPID          uuid.UUID `json:"ssp-id"`
	SSPTitle       string    `json:"ssp-title"`
	ComponentID    uuid.UUID `json:"component-id"`
	ComponentTitle string    `json:"component-title"`
}

LinkedSSP is an SSP system component linked to a defined component.

type ListParams

type ListParams struct {
	// Search matches titles case-insensitively.
	Search string
	// Kinds limits the kinds listed; empty means all.
	Kinds []Kind
	// SSPID limits system components to one SSP; other kinds are unaffected.
	SSPID *uuid.UUID
	// IDs limits the list to these subjects.
	IDs    []uuid.UUID
	Limit  int
	Offset int
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(db *gorm.DB) *Service

func (*Service) List

func (s *Service) List(ctx context.Context, params ListParams) ([]Summary, int64, error)

List returns one page of subjects ordered by title, and the total matching.

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, ids []uuid.UUID) (map[uuid.UUID]Summary, error)

Resolve looks up subjects by ID, returning those found keyed by ID.

type Summary

type Summary struct {
	SubjectUUID uuid.UUID `json:"subject-uuid" gorm:"column:subject_uuid"`
	// Type is the OSCAL subject type: component, party or user.
	Type  string `json:"type" gorm:"column:type"`
	Kind  Kind   `json:"kind" gorm:"column:kind"`
	Title string `json:"title" gorm:"column:title"`
	// Context is what the subject belongs to: a defined component's component definition, or
	// a system component's SSP.
	Context *string `json:"context,omitempty" gorm:"column:context"`
	// Identity is a defined component's identity labels: the evidence labels that identify it.
	Identity []IdentityLabel `json:"identity,omitempty" gorm:"-"`
	// LinkedSSPs are the SSP system components a defined component is linked to.
	LinkedSSPs []LinkedSSP `json:"linked-ssps,omitempty" gorm:"-"`
}

Summary is an entity evidence can name as its subject.

Jump to

Keyboard shortcuts

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