team

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package team adds person-scoped, local-first access control on top of the audit operator. A committed team file lists members and their roles; viewers are blocked from operations that change a database, while admins/editors may proceed. There is no server — the team file lives in the project (or ~/.litescope) and is enforced by the same write entry points as the policy.

Index

Constants

View Source
const DefaultFile = "litescope.team.yaml"

DefaultFile is the conventional per-project team filename.

Variables

This section is empty.

Functions

func Allow

func Allow() error

Allow is a convenience that loads the team config and checks the current audit operator, returning an error when the operator may not write.

Types

type Config

type Config struct {
	Team    string   `yaml:"team"`
	Members []Member `yaml:"members"`
	// Strict blocks any operator who is not listed as a member. When false
	// (default), unknown operators are allowed — the team file only constrains
	// the people it names.
	Strict bool `yaml:"strict"`
	// contains filtered or unexported fields
}

Config is a parsed team file.

func Load

func Load() (*Config, error)

Load resolves a team config from, in order: $LITESCOPE_TEAM, ./litescope.team.yaml, ~/.litescope/team.yaml. A missing file is not an error — it returns an empty (allow-all) config.

func (*Config) CanWrite

func (c *Config) CanWrite(operator string) (bool, string)

CanWrite reports whether operator may perform a mutating operation, with a human-readable reason when they may not. A nil/empty config allows everyone.

func (*Config) Empty

func (c *Config) Empty() bool

Empty reports whether the config constrains nobody.

func (*Config) Role

func (c *Config) Role(operator string) string

Role returns the role of operator, or "" if not listed. Matching is case-insensitive on the name.

func (*Config) Source

func (c *Config) Source() string

Source returns the file the config was loaded from ("" when none).

type Member

type Member struct {
	Name string `yaml:"name"`
	Role string `yaml:"role"` // admin | editor | viewer
}

Member is one person on the team.

Jump to

Keyboard shortcuts

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