auth

package
v0.8.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRuleLoadError  = fmt.Errorf("rule load failure")
	ErrNoRulesDefined = fmt.Errorf("command has no rules")
)

Functions

func EvaluateCommandEntry

func EvaluateCommandEntry(perms []string, ce data.CommandEntry, env rules.EvaluationEnvironment) (bool, error)

EvaluateCommandEntry is equivalent to EvaluateRules, except that it accepts a data.Command entry from which it builds its complete rules set, upon which it calls EvaluateRules. It returns true if the provided permissions meet the requirements derived by the CommandEntry and EvaluationEnvironment. It returns an error if there isn't at least one rule in the Rule slice.

func EvaluateRules

func EvaluateRules(perms []string, r []rules.Rule, env rules.EvaluationEnvironment) (bool, error)

EvaluateRules returns true if the provided permissions meet the requirements defined by the given rules and EvaluationEnvironment. It returns an error if there isn't at least one rule in the Rule slice.

func ParseCommandEntry

func ParseCommandEntry(ce data.CommandEntry) ([]rules.Rule, error)

ParseCommandEntry is a helper function that accepts a fully-constructed data.CommandEntry, tokenizes and parses all of the command's rule strings, and returns a []Rules value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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