load

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EffectorAllowOverride = "allow-override"
	EffectorDenyOverride  = "deny-override"
	EffectorAllowAndDeny  = "allow-and-deny"
)

Variables

View Source
var (
	ErrNeedEffectFieldKey = errors.New("must give an effect field key")
	ErrUnknownEffectType  = errors.New("unknown policy effect type")
)

Functions

func ModelFromViper

func ModelFromViper(v *viper.Viper, options ...ModelOption) (model *core.Model, err error)

ModelFromViper load model definetion from a viper instance.

You can use viper to load a concrete configure file in JSON, TOML, YAML format.

TOML format example:

[request_definition]
r = "sub, dom, obj, act"

[policy_definition]
p = "sub, obj, act"

[role_definition]
g =  "_, _, _"
g1 = "_, _"

[policy_effect]
type = "allow-override"

[matchers]
m = "g(r.sub, p.sub, r.dom) && r.obj == p.obj && r.act == p.act"

Types

type CSVIterator

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

func NewCSVIterator

func NewCSVIterator(ioReader io.Reader) (itr *CSVIterator)

NewCSVIterator constructs an iterator that load CSV data from an io.Reader.

The CSV data must be in the format described in RFC 4180.

Additional support comments that start with '#'.

func (*CSVIterator) Error

func (it *CSVIterator) Error() (err error)

func (*CSVIterator) Next

func (it *CSVIterator) Next() (ok bool, key string, vals []string)

type ModelOption

type ModelOption interface {
	// contains filtered or unexported methods
}

An option configures a new model when load it.

func ExtensionFuncs

func ExtensionFuncs(funcs ...core.ExtensionFunc) ModelOption

func RoleDomainMatch

func RoleDomainMatch(key string, fn core.RoleDomainMatchFunc) ModelOption

Jump to

Keyboard shortcuts

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