groupref

package
v0.28.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package groupref finds the objects that reference auth provider groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPrefix

func HasPrefix(prefix string) func(groupID string) bool

HasPrefix matches the group IDs that start with prefix.

func RemoveGroupSubjects

func RemoveGroupSubjects(ctx context.Context, c kclient.Client, namespace string, match func(groupID string) bool) (map[Kind]int, error)

RemoveGroupSubjects removes the group subjects that match from every access policy in namespace, and returns the number of objects of each kind that it changed.

It changes neither group role assignments, which live in the gateway database, nor the profiles of virtual MCP servers, which must keep at least one subject. A subject naming a group that no longer exists matches nobody.

func RemoveSubjects

func RemoveSubjects(subjects []types.Subject, match func(groupID string) bool) ([]types.Subject, bool)

RemoveSubjects returns subjects without the group subjects that match, and whether any were removed. The order of the remaining subjects is kept.

func VMCPProfileSubjects

func VMCPProfileSubjects(manifest types.VMCPManifest) []types.Subject

VMCPProfileSubjects returns the subjects of every profile of a virtual MCP server.

func WriteNewGroups

func WriteNewGroups(ctx context.Context, gateway *gclient.Client, storage kclient.Reader, groupIDs []string, write func() error) error

WriteNewGroups runs write, which saves new references to groupIDs, as WriteNewSubjects does.

func WriteNewSubjects

func WriteNewSubjects(ctx context.Context, gateway *gclient.Client, storage kclient.Reader, subjects, previous []types.Subject, write func() error) error

WriteNewSubjects runs write, which saves subjects in place of previous, and returns what write returns. The group subjects that subjects adds must reach groups of a SCIM connection's auth provider: a group of the provider must have the ID, and must not be being deleted because nothing referenced it. Such a reference would match nobody, and no pushed group could bind to it. Subjects that previous already has are left alone, so an old reference to a missing group does not block unrelated edits.

The write is recorded while it runs, so a deletion of unreferenced groups either waits for it and reads the new references, or marks its groups first and write is refused. A refusal is a bad request that names the provider by its display name, which is read from storage.

Types

type Finder

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

Finder finds the objects that reference groups: every access policy type (model access policies are the LLM gateway's profiles, which carry its budgets and guardrail policies), group role assignments, the profiles of virtual MCP servers, and guardrail filters.

func NewFinder

func NewFinder(storage kclient.Reader, roles RoleAssignmentLister) *Finder

NewFinder returns a Finder that reads objects from storage and group role assignments from roles.

func (*Finder) Find

func (f *Finder) Find(ctx context.Context, namespace string, match func(groupID string) bool) (References, error)

Find returns the references in namespace to the groups whose IDs match, sorted by kind, name, and detail.

type Kind

type Kind string

Kind is a kind of object that can reference groups.

const (
	KindAccessControlRule   Kind = "accessControlRule"
	KindModelAccessPolicy   Kind = "modelAccessPolicy"
	KindSkillAccessRule     Kind = "skillAccessRule"
	KindMessagePolicy       Kind = "messagePolicy"
	KindGroupRoleAssignment Kind = "groupRoleAssignment"
	KindVMCPProfile         Kind = "vmcpProfile"
	KindMCPGuardrailFilter  Kind = "mcpGuardrailFilter"
)

type Reference

type Reference struct {
	Kind Kind
	// Name identifies the object: its name, or the group ID for a group role assignment.
	Name        string
	DisplayName string
	// Detail says where in the object the reference is, such as the version of a published artifact, the profile
	// of a virtual MCP server, or the role a group role assignment grants.
	Detail string
}

Reference is one object that references a group.

type References

type References map[string][]Reference

References maps group IDs to the objects that reference them.

type RoleAssignmentLister

type RoleAssignmentLister interface {
	ListGroupRoleAssignments(ctx context.Context) ([]gatewaytypes.GroupRoleAssignment, error)
}

RoleAssignmentLister lists group role assignments, which live in the gateway database.

Jump to

Keyboard shortcuts

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