namespace

package
v3.0.0-...-9d75b9b Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNamespace used by the server
	DefaultNamespace = "micro"
)

Variables

View Source
var (
	// ErrUnauthorized is returned by Authorize when a context without a blank account tries to access
	// a restricted namespace
	ErrUnauthorized = errors.New("an account is required")
	// ErrForbidden is returned by Authorize when a context is trying to access a namespace it doesn't
	// have access to
	ErrForbidden = errors.New("access denied to namespace")
)

Functions

func Authorize

func Authorize(ctx context.Context, namespace, method string, opts ...AuthorizeOption) error

Authorize will return a service error if the context cannot access the given namespace

func AuthorizeAdmin

func AuthorizeAdmin(ctx context.Context, ns, method string) error

AuthorizeAdmin returns a service error if the context is not an admin that can access this namespace e.g. either an admin for the this namespace or an admin for micro

Types

type AuthorizeOption

type AuthorizeOption func(o *AuthorizeOptions)

AuthorizeOption sets an attribute on AuthorizeOptions

func Public

func Public(ns string) AuthorizeOption

Public indicates a namespace is public and can be accessed by anyone

type AuthorizeOptions

type AuthorizeOptions struct {
	PublicNamespace string
}

AuthorizeOptions are used to configure the Authorize method

Jump to

Keyboard shortcuts

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