access

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 1 Imported by: 8

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 added in v1.10.0

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

func (*ResponseImpl) Allowed added in v1.10.0

func (r *ResponseImpl) Allowed() bool

func (*ResponseImpl) Message added in v1.10.0

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