invoke

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check interface {
	Check(ctx context.Context, request *base.PermissionCheckRequest) (response *base.PermissionCheckResponse, err error)
}

Check is an interface that defines a method for checking permissions. It requires an implementation of InvokeCheck that takes a context and a PermissionCheckRequest, and returns a PermissionCheckResponse and an error if any.

type DirectInvoker

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

DirectInvoker is a struct that implements the Invoker interface. It holds references to various engines needed for permission-related operations.

func NewDirectInvoker

func NewDirectInvoker(
	schemaReader storage.SchemaReader,
	dataReader storage.DataReader,
	cc Check,
	ec Expand,
	lo Lookup,
	sp SubjectPermission,
	meter api.Meter,
) *DirectInvoker

NewDirectInvoker is a constructor for DirectInvoker. It takes pointers to CheckEngine, ExpandEngine, LookupSchemaEngine, and LookupEntityEngine as arguments and returns an Invoker instance.

func (*DirectInvoker) Check

func (invoker *DirectInvoker) Check(ctx context.Context, request *base.PermissionCheckRequest) (response *base.PermissionCheckResponse, err error)

Check is a method that implements the Check interface. It calls the Run method of the CheckEngine with the provided context and PermissionCheckRequest, and returns a PermissionCheckResponse and an error if any.

func (*DirectInvoker) Expand

func (invoker *DirectInvoker) Expand(ctx context.Context, request *base.PermissionExpandRequest) (response *base.PermissionExpandResponse, err error)

Expand is a method that implements the Expand interface. It calls the Run method of the ExpandEngine with the provided context and PermissionExpandRequest, and returns a PermissionExpandResponse and an error if any.

func (*DirectInvoker) LookupEntity

func (invoker *DirectInvoker) LookupEntity(ctx context.Context, request *base.PermissionLookupEntityRequest) (response *base.PermissionLookupEntityResponse, err error)

LookupEntity is a method that implements the LookupEntity interface. It calls the Run method of the LookupEntityEngine with the provided context and PermissionLookupEntityRequest, and returns a PermissionLookupEntityResponse and an error if any.

func (*DirectInvoker) LookupEntityStream

func (invoker *DirectInvoker) LookupEntityStream(ctx context.Context, request *base.PermissionLookupEntityRequest, server base.Permission_LookupEntityStreamServer) (err error)

LookupEntityStream is a method that implements the LookupEntityStream interface. It calls the Stream method of the LookupEntityEngine with the provided context, PermissionLookupEntityRequest, and Permission_LookupEntityStreamServer, and returns an error if any.

func (*DirectInvoker) LookupSubject added in v0.4.1

func (invoker *DirectInvoker) LookupSubject(ctx context.Context, request *base.PermissionLookupSubjectRequest) (response *base.PermissionLookupSubjectResponse, err error)

LookupSubject is a method of the DirectInvoker structure. It handles the task of looking up subjects and returning the results in a response.

func (*DirectInvoker) SubjectPermission added in v0.4.7

func (invoker *DirectInvoker) SubjectPermission(ctx context.Context, request *base.PermissionSubjectPermissionRequest) (response *base.PermissionSubjectPermissionResponse, err error)

SubjectPermission is a method of the DirectInvoker structure. It handles the task of subject's permissions and returning the results in a response.

type Expand

type Expand interface {
	Expand(ctx context.Context, request *base.PermissionExpandRequest) (response *base.PermissionExpandResponse, err error)
}

Expand is an interface that defines a method for expanding permissions. It requires an implementation of InvokeExpand that takes a context and a PermissionExpandRequest, and returns a PermissionExpandResponse and an error if any.

type Invoker

type Invoker interface {
	Check
	Expand
	Lookup
	SubjectPermission
}

Invoker is an interface that groups multiple permission-related interfaces. It is used to define a common contract for invoking various permission operations.

type Lookup added in v0.5.0

type Lookup interface {
	LookupEntity(ctx context.Context, request *base.PermissionLookupEntityRequest) (response *base.PermissionLookupEntityResponse, err error)
	LookupEntityStream(ctx context.Context, request *base.PermissionLookupEntityRequest, server base.Permission_LookupEntityStreamServer) (err error)
	LookupSubject(ctx context.Context, request *base.PermissionLookupSubjectRequest) (response *base.PermissionLookupSubjectResponse, err error)
}

type SubjectPermission added in v0.4.7

type SubjectPermission interface {
	SubjectPermission(ctx context.Context, request *base.PermissionSubjectPermissionRequest) (response *base.PermissionSubjectPermissionResponse, err error)
}

SubjectPermission -

Jump to

Keyboard shortcuts

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