permission

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeSys                   = "sys"
	ScopeOrg                   = "org"
	ScopeProject               = "project"
	ScopeApp                   = "app"
	ScopePublisher             = "publisher"
	ScopeMicroService          = "micro_service"
	MonitorProjectAlert string = "monitor_project_alert"
)

Scope values

View Source
const (
	ActionCreate  = "CREATE"
	ActionDelete  = "DELETE"
	ActionUpdate  = "UPDATE"
	ActionGet     = "GET"
	ActionList    = "LIST"
	ActionOperate = "OPERATE"
)

Action values

Variables

This section is empty.

Functions

func GetPermissionDataFromContext

func GetPermissionDataFromContext(ctx context.Context, key string) (interface{}, bool)

GetPermissionDataFromContext .

func SetPermissionDataFromContext

func SetPermissionDataFromContext(ctx context.Context, key string, val interface{})

SetPermissionDataFromContext .

func WithPermissionDataContext

func WithPermissionDataContext(ctx context.Context) context.Context

WithPermissionDataContext .

Types

type Action

type Action string

Action .

type Interface

type Interface interface {
	Check(perms ...*Permission) transport.ServiceOption
}

Interface .

type Option

type Option func(*Permission)

func WithSkipPermInternalClient

func WithSkipPermInternalClient(skip bool) Option

type Permission

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

Permission .

func Method

func Method(method interface{}, scope, resource interface{}, action Action, id ValueGetter, options ...Option) *Permission

Method .

func NoPermMethod

func NoPermMethod(method interface{}) *Permission

NoPermMethod 。

func (*Permission) String

func (p *Permission) String() string

type Scope

type Scope string

Scope .

type ValueGetter

type ValueGetter func(ctx context.Context, req interface{}) (string, error)

ValueGetter .

func FieldValue

func FieldValue(field string) ValueGetter

FieldValue .

func FiexdValue

func FiexdValue(v string) ValueGetter

FiexdValue .

func HeaderValue

func HeaderValue(key string) ValueGetter

HeaderValue

func OrgIDValue

func OrgIDValue() ValueGetter

OrgIDValue

Jump to

Keyboard shortcuts

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