workspace

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Overview

Package workspace defines workspace scope, grants, and path authorization.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRootRequired       = errors.New("root is required")
	ErrRootNotDirectory   = errors.New("root must be an existing directory")
	ErrPathRequired       = errors.New("path is required")
	ErrAccessRequired     = errors.New("access is required")
	ErrPermissionRequired = errors.New("path requires user approval")
)

Functions

This section is empty.

Types

type Access

type Access string
const (
	AccessRead    Access = "read"
	AccessWrite   Access = "write"
	AccessList    Access = "list"
	AccessExec    Access = "exec"
	AccessWorkdir Access = "workdir"
)

type Decision

type Decision struct {
	Access       Access
	InputPath    string
	ResolvedPath string
	WithinRoot   bool
	Granted      bool
}

func (Decision) Allowed

func (d Decision) Allowed() bool

func (Decision) RequiresApproval

func (d Decision) RequiresApproval() bool

type Grant

type Grant struct {
	Path      string
	Recursive bool
}

type Options

type Options struct {
	Grants []Grant
}

type Scope

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

func New

func New(root string, opts ...Options) (*Scope, error)

func (*Scope) Authorize

func (s *Scope) Authorize(access Access, path string) (Decision, error)

func (*Scope) Check

func (s *Scope) Check(access Access, path string) (Decision, error)

func (*Scope) Grant

func (s *Scope) Grant(path string, recursive bool) (Grant, error)

func (*Scope) Grants

func (s *Scope) Grants() []Grant

func (*Scope) Root

func (s *Scope) Root() string

Jump to

Keyboard shortcuts

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