expand

package
v0.7.0-alpha.0.pre.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const RouteBase = "/expand"

Variables

View Source
var (
	ErrUnknownNodeType = errors.New("unknown node type")
)

Functions

func NewHandler

func NewHandler(d handlerDependencies) *handler

Types

type Engine

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

func NewEngine

func NewEngine(d EngineDependencies) *Engine

func (*Engine) BuildTree

func (e *Engine) BuildTree(ctx context.Context, subject relationtuple.Subject, restDepth int) (*Tree, error)

type EngineDependencies

type EngineDependencies interface {
	relationtuple.ManagerProvider
}

type EngineProvider

type EngineProvider interface {
	ExpandEngine() *Engine
}

type NodeType

type NodeType string

swagger:enum NodeType

const (
	Union        NodeType = "union"
	Exclusion    NodeType = "exclusion"
	Intersection NodeType = "intersection"
	Leaf         NodeType = "leaf"
)

func NodeTypeFromProto

func NodeTypeFromProto(t acl.NodeType) NodeType

func (NodeType) String

func (t NodeType) String() string

func (NodeType) ToProto

func (t NodeType) ToProto() acl.NodeType

func (*NodeType) UnmarshalJSON

func (t *NodeType) UnmarshalJSON(v []byte) error

type Tree

type Tree struct {
	Type     NodeType              `json:"type"`
	Subject  relationtuple.Subject `json:"subject"`
	Children []*Tree               `json:"children,omitempty"`
}

swagger:ignore

func TreeFromProto

func TreeFromProto(t *acl.SubjectTree) (*Tree, error)

swagger:ignore

func (*Tree) MarshalJSON

func (t *Tree) MarshalJSON() ([]byte, error)

func (*Tree) String

func (t *Tree) String() string

func (*Tree) ToProto

func (t *Tree) ToProto() *acl.SubjectTree

swagger:ignore

func (*Tree) UnmarshalJSON

func (t *Tree) UnmarshalJSON(v []byte) error

Jump to

Keyboard shortcuts

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