group

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 9 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 PersonalAccountAttribute = "personalAccount"

PersonalAccountAttribute is the directory attribute the group's PersonalAccount is stored under.

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

func SameExceptPersonalAccount added in v0.20.0

func SameExceptPersonalAccount(a, b *Group) bool

SameExceptPersonalAccount reports whether a and b differ in nothing but personalAccount: name, display name, owner, members and enabled flag.

Types

type External added in v0.10.8

type External struct {
	Source string `json:"source"       doc:"Name of the SCIM client that provisioned the group."`
	ID     string `json:"id,omitempty" doc:"The group's id at that source."`
}

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. A group written as system-owned reads as the organization's.

func (*Group) IsEnabled

func (g *Group) IsEnabled() bool

IsEnabled returns true when Enabled is unset or explicitly true.

func (*Group) PersonalAccountOwnerRule added in v0.20.0

func (g *Group) PersonalAccountOwnerRule() error

PersonalAccountOwnerRule refuses personalAccount on a group the organization does not own: whoever owns a user's group edits its members and enabled flag, which would let a non-admin turn other users' personal accounts on or off.

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 organization (system, its earlier name, is read as it), and organization when personalAccount is set.
  • 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" doc:"Ids of the member users."`

	// Enabled defaults to true when nil.
	Enabled *bool `` /* 138-byte string literal not displayed */

	// PersonalAccount is the group's say on its members' personal accounts; empty leaves it to the deployment's accounts setting.
	PersonalAccount string `` /* 562-byte string literal not displayed */
}

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