group

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package group is the domain layer for the Group entity — a named set of users that role bindings can name as a subject. Local groups only: an IdP group of the same name unions with this one at login, and is never an object here.

Authorization is app/authz's concern; this package validates shape only.

Index

Constants

View Source
const SystemPrefix = "system:"

SystemPrefix marks the built-in virtual groups (system:authenticated, system:serviceaccounts, …). They are never rows, so a stored Group may not claim one of those names.

Variables

This section is empty.

Functions

This section is empty.

Types

type External added in v0.10.8

type External struct {
	Source string `json:"source"`
	ID     string `json:"id,omitempty"`
}

External names the provisioning source that manages a group and the source's own id for it.

type Group

type Group struct {
	Meta meta.Metadata `json:"metadata" yaml:"metadata"`
	Spec Spec          `json:"spec"     yaml:"spec"`
	// External is set on a group a provisioning source manages. The server owns it: a write that carries it is ignored, so no caller can hand a group to a source.
	External *External `` /* 199-byte string literal not displayed */
}

Group is a named set of users.

func FromDirectory added in v0.10.8

func FromDirectory(r *directory.Group) *Group

FromDirectory is a directory row as a Group.

func (*Group) IsEnabled

func (g *Group) IsEnabled() bool

IsEnabled returns true when Enabled is unset or explicitly true.

func (*Group) ToDirectory added in v0.10.8

func (g *Group) ToDirectory() *directory.Group

ToDirectory is g as the directory stores it. External is left out: the directory keeps the stored one when a write carries none, and a caller must not be able to set it.

func (*Group) Validate

func (g *Group) Validate() error

Validate runs intra-row rules via the shared meta.Validator and enforces:

  • Owner.Kind is user or system.
  • the name does not claim a built-in virtual group.
  • no duplicate member ids.

type Spec

type Spec struct {
	// MemberIDs are User ids, in declaration order.
	MemberIDs []string `json:"memberIds,omitempty" yaml:"memberIds,omitempty" validate:"omitempty,dive,uuid"`

	// Enabled defaults to true when nil.
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
}

Spec carries the member list and the enabled flag.

type Store

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

func NewStore

func NewStore(db storage.DB) *Store

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete relies on the FK to cascade the junction rows.

func (*Store) Directory added in v0.10.8

func (s *Store) Directory() directory.Store[directory.Group]

Directory is the auth module's store under this one, for writes that run through the directory.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (*Group, error)

Get returns (nil, nil) when no row has id.

func (*Store) List

func (s *Store) List(ctx context.Context) ([]*Group, error)

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, g *Group) error

Jump to

Keyboard shortcuts

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