Documentation
¶
Index ¶
Constants ¶
const ( FileName = "syft.pub.yaml" TokenUser = "USER" TokenEveryone = "*" AllFiles = "**" Terminal = true NotTerminal = false )
Variables ¶
This section is empty.
Functions ¶
func WithoutACLPath ¶
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 ¶
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 ¶
SharedReadAccess returns an Access object with read access for the specified users.
func SharedReadWriteAccess ¶
SharedWriteAccess returns an Access object with write access for the specified users.
func (Access) MarshalYAML ¶
func (*Access) UnmarshalYAML ¶
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 ¶
NewDefaultRule creates a new Rule with `**` as Pattern and the provided 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 ¶
LoadFromFile loads a RuleSet from the specified file path
func LoadFromReader ¶
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 ¶
NewRuleSet creates a new RuleSet instance with the given path, terminal flag, and initial rules.