check

package
v0.10.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteBase        = "/relation-tuples/check"
	OpenAPIRouteBase = RouteBase + "/openapi"
)
View Source
const WildcardRelation = "..."

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

func NewEngine

func NewEngine(d EngineDependencies, opts ...EngineOpt) *Engine

func (*Engine) CheckIsMember

func (e *Engine) CheckIsMember(ctx context.Context, r *relationTuple, restDepth int) (bool, error)

CheckIsMember checks if the relation tuple's subject has the relation on the object in the namespace either directly or indirectly and returns a boolean result.

func (*Engine) CheckRelationTuple

func (e *Engine) CheckRelationTuple(ctx context.Context, r *relationTuple, restDepth int) checkgroup.Result

CheckRelationTuple checks if the relation tuple's subject has the relation on the object in the namespace either directly or indirectly and returns a check result.

type EngineDependencies

type EngineDependencies interface {
	relationtuple.ManagerProvider
	config.Provider
	x.LoggerProvider
}

type EngineOpt

type EngineOpt func(*Engine)

type EngineProvider

type EngineProvider interface {
	PermissionEngine() *Engine
}

type Handler

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

func NewHandler

func NewHandler(d handlerDependencies) *Handler

func (*Handler) Check

func (h *Handler) Check(ctx context.Context, req *rts.CheckRequest) (*rts.CheckResponse, error)

func (*Handler) RegisterReadGRPC

func (h *Handler) RegisterReadGRPC(s *grpc.Server)

func (*Handler) RegisterReadRoutes

func (h *Handler) RegisterReadRoutes(r *x.ReadRouter)

func (*Handler) RegisterWriteGRPC

func (h *Handler) RegisterWriteGRPC(_ *grpc.Server)

func (*Handler) RegisterWriteRoutes

func (h *Handler) RegisterWriteRoutes(_ *x.WriteRouter)

type RESTResponse

type RESTResponse struct {
	// whether the relation tuple is allowed
	//
	// required: true
	Allowed bool `json:"allowed"`
}

RESTResponse represents the response for a check request.

The content of the allowed field is mirrored in the HTTP status code.

swagger:model getCheckResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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