aclspec

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName      = "syft.pub.yaml"
	TokenUser     = "USER"
	TokenEveryone = "*"
	AllFiles      = "**"
	Terminal      = true
	NotTerminal   = false
)

Variables

This section is empty.

Functions

func AsACLPath

func AsACLPath(path string) string

AsACLPath converts any path to exact acl file path

func Exists

func Exists(path string) bool

Exists checks if the ACL file exists at the given path

func IsACLFile

func IsACLFile(path string) bool

IsACLFile checks if the path is an syft.pub.yaml file

func WithoutACLPath

func WithoutACLPath(path string) string

WithoutACLPath truncates syft.pub.yaml from the path

Types

type Access

type Access struct {
	Admin mapset.Set[string] `yaml:"admin"`
	Read  mapset.Set[string] `yaml:"read"`
	Write mapset.Set[string] `yaml:"write"`
}

func NewAccess

func NewAccess(admin []string, write []string, read []string) *Access

NewAccess creates a new Access object with the specified admin, write, and read users.

func PrivateAccess

func PrivateAccess() *Access

PrivateAccess returns an Access object with no users.

func PublicReadAccess

func PublicReadAccess() *Access

PublicReadAccess returns an Access object with read access for everyone.

func PublicReadWriteAccess

func PublicReadWriteAccess() *Access

PublicReadWriteAccess returns an Access object with read and write access for everyone.

func SharedReadAccess

func SharedReadAccess(users ...string) *Access

SharedReadAccess returns an Access object with read access for the specified users.

func SharedReadWriteAccess

func SharedReadWriteAccess(users ...string) *Access

SharedWriteAccess returns an Access object with write access for the specified users.

func (Access) MarshalYAML

func (a Access) MarshalYAML() (interface{}, error)

func (*Access) UnmarshalYAML

func (a *Access) UnmarshalYAML(value *yaml.Node) error

type Limits

type Limits struct {
	MaxFileSize   int64  `yaml:"maxFileSize,omitempty"`
	MaxFiles      uint32 `yaml:"maxFiles,omitempty"`
	AllowDirs     bool   `yaml:"allowDirs,omitempty"`
	AllowSymlinks bool   `yaml:"allowSymlinks,omitempty"`
}

func DefaultLimits

func DefaultLimits() *Limits

type Rule

type Rule struct {
	Pattern string  `yaml:"pattern"`
	Access  *Access `yaml:"access"`
	Limits  *Limits `yaml:"-"` // todo - re-enable this later
}

Rule represents a rule in the ACL file It contains a pattern, access control list, and optional limits The pattern is a glob string that specifies the files or directories to which the rule applies The access control list specifies the users who have access to the files or directories The limits specify the maximum number of files or directories that can be accessed

func NewDefaultRule

func NewDefaultRule(access *Access, limits *Limits) *Rule

NewDefaultRule creates a new Rule with `**` as Pattern and the provided Access and Limits.

func NewRule

func NewRule(pattern string, access *Access, limits *Limits) *Rule

NewRule creates a new Rule with the specified pattern, access, and limits.

type RuleSet

type RuleSet struct {
	Rules    []*Rule `yaml:"rules,omitempty"`
	Terminal bool    `yaml:"terminal,omitempty"`
	Path     string  `yaml:"-"`
}

RuleSet represents a set of rules for access control, including a list of rules and a terminal flag. Path is the location for which the rules apply.

func LoadFromFile

func LoadFromFile(path string) (*RuleSet, error)

LoadFromFile loads a RuleSet from the specified file path

func LoadFromReader

func LoadFromReader(path string, reader io.Reader) (*RuleSet, error)

LoadFromReader creates a RuleSet by reading and parsing YAML content from the provided reader. The path parameter is used to set the internal path of the RuleSet.

func NewRuleSet

func NewRuleSet(path string, terminal bool, rules ...*Rule) *RuleSet

NewRuleSet creates a new RuleSet instance with the given path, terminal flag, and initial rules.

func (*RuleSet) AllRules

func (r *RuleSet) AllRules() []*Rule

func (*RuleSet) Save

func (r *RuleSet) Save() error

Jump to

Keyboard shortcuts

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