access

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gate

type Gate interface {
	WithContext(ctx context.Context) Gate
	Allows(ability string, arguments map[string]any) bool
	Denies(ability string, arguments map[string]any) bool
	Inspect(ability string, arguments map[string]any) Response
	Define(ability string, callback func(ctx context.Context, arguments map[string]any) Response)
	Any(abilities []string, arguments map[string]any) bool
	None(abilities []string, arguments map[string]any) bool
	Before(callback func(ctx context.Context, ability string, arguments map[string]any) Response)
	After(callback func(ctx context.Context, ability string, arguments map[string]any, result Response) Response)
}

type Response

type Response interface {
	Allowed() bool
	Message() string
}

func NewAllowResponse

func NewAllowResponse() Response

func NewDenyResponse

func NewDenyResponse(message string) Response

type ResponseImpl

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

func (*ResponseImpl) Allowed

func (r *ResponseImpl) Allowed() bool

func (*ResponseImpl) Message

func (r *ResponseImpl) Message() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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