program

package
v0.0.0-...-7a19e20 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextContains

func ContextContains(ctx context.Context, scope string) bool

ContextContains returns true if the argument is encompassed in general scope and current program scope. If the context doesn't have a Scope, this function behaves like gate/scope.ContextContains.

func ContextWithScope

func ContextWithScope(ctx context.Context) context.Context

ContextWithScope adds program scope.

Types

type Scope

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

Scope is dynamic program scope filter. It is unrestricted by default.

func ContextScope

func ContextScope(ctx context.Context) *Scope

ContextScope returns the contextual program scope or nil.

func (*Scope) Contains

func (x *Scope) Contains(scope string) bool

Contains returns true if the argument is encompassed in the current scope.

func (*Scope) Restrict

func (x *Scope) Restrict(scope []string) error

Restrict sets the scope to the intersection of the existing scope and the argument.

func (*Scope) Scope

func (x *Scope) Scope() (scope []string, restricted bool)

Scope returns a scope array if restricted, or nil if unrestricted.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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