user

package
Version: v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRange = errors.New("invalid range; a range must consist of positive integers and the upper bound must be greater than or equal to the lower bound")
)

Range errors

Functions

func IsOnbuildAllowed

func IsOnbuildAllowed(directives []string, allowed *RangeList) bool

IsOnbuildAllowed checks a list of Docker ONBUILD instructions for user directives. It ensures that any users specified by the directives falls within the specified range list of users.

func IsUserAllowed

func IsUserAllowed(user string, allowed *RangeList) bool

IsUserAllowed checks that the given user is numeric and is contained by the given RangeList

Types

type ErrParseRange

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

ErrParseRange is an error encountered while parsing a Range

func (*ErrParseRange) Error

func (e *ErrParseRange) Error() string

type Range

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

Range represents a range of user ids. It can be unbound at either end with a nil value I both From and To are present, To must be greater than or equal to From. Bounds are inclusive

func NewRange

func NewRange(from int, to int) (*Range, error)

NewRange creates a new range with lower and upper bound

func NewRangeFrom

func NewRangeFrom(from int) (*Range, error)

NewRangeFrom creates a new range with only the lower bound

func NewRangeTo

func NewRangeTo(to int) (*Range, error)

NewRangeTo creates a new range with only the upper bound

func ParseRange

func ParseRange(value string) (*Range, error)

ParseRange creates a Range from a given string

func (*Range) Contains

func (r *Range) Contains(value int) bool

Contains returns true if the argument falls inside the Range

func (*Range) Empty

func (r *Range) Empty() bool

Empty returns true if the range has no bounds

func (*Range) Set

func (r *Range) Set(value string) error

Set sets the value of a Range object

func (*Range) String

func (r *Range) String() string

String returns a parse-able string representation of a Range

func (*Range) Type

func (r *Range) Type() string

Type returns the type of a Range object

type RangeList

type RangeList []*Range

RangeList is a list of user ranges

func ParseRangeList

func ParseRangeList(str string) (*RangeList, error)

ParseRangeList parses a string that contains a comma-separated list of ranges

func (*RangeList) Contains

func (l *RangeList) Contains(uid int) bool

Contains returns true if the uid is contained by any range in the RangeList

func (*RangeList) Empty

func (l *RangeList) Empty() bool

Empty returns true if the RangeList is empty

func (*RangeList) Set

func (l *RangeList) Set(value string) error

Set sets the value of a RangeList object

func (*RangeList) String

func (l *RangeList) String() string

String returns a parseable string representation of a RangeList

func (*RangeList) Type

func (l *RangeList) Type() string

Type returns the type of a RangeList object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL