graph

package
v0.2.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildingGraph = errors.New("cannot build graph")

Functions

This section is empty.

Types

type AuthorizationModelEdge

type AuthorizationModelEdge struct {
	graph.Line
	// contains filtered or unexported fields
}

func (*AuthorizationModelEdge) Attributes

func (n *AuthorizationModelEdge) Attributes() []encoding.Attribute

type AuthorizationModelGraph

type AuthorizationModelGraph struct {
	*multi.DirectedGraph
}

func NewAuthorizationModelGraph

func NewAuthorizationModelGraph(model *openfgav1.AuthorizationModel) (*AuthorizationModelGraph, error)

NewAuthorizationModelGraph builds an authorization model in graph form. For example, types such as `group`, usersets such as `group#member` and wildcards `group:*` are encoded as nodes.

The edges are defined by the assignments, e.g. `define viewer: [group]` defines an edge from group to document#viewer. Conditions are not encoded in the graph, and the two edges in an exclusion are not distinguished.

func (*AuthorizationModelGraph) Attributes

func (g *AuthorizationModelGraph) Attributes() []encoding.Attribute

func (*AuthorizationModelGraph) DOTAttributers

func (*AuthorizationModelGraph) GetDOT

func (g *AuthorizationModelGraph) GetDOT() string

GetDOT returns the DOT visualization. The output text is stable. It should only be used for debugging.

type AuthorizationModelGraphBuilder

type AuthorizationModelGraphBuilder struct {
	graph.DirectedMultigraphBuilder
	// contains filtered or unexported fields
}

func (*AuthorizationModelGraphBuilder) AddEdge

func (g *AuthorizationModelGraphBuilder) AddEdge(from, to graph.Node, edgeType EdgeType, conditionedOn string) *AuthorizationModelEdge

func (*AuthorizationModelGraphBuilder) GetNodeFor

func (g *AuthorizationModelGraphBuilder) GetNodeFor(uniqueLabel string) *AuthorizationModelNode

func (*AuthorizationModelGraphBuilder) GetOrAddNode

func (g *AuthorizationModelGraphBuilder) GetOrAddNode(uniqueLabel, label string, nodeType NodeType) *AuthorizationModelNode

func (*AuthorizationModelGraphBuilder) HasEdge

func (g *AuthorizationModelGraphBuilder) HasEdge(from, to graph.Node, edgeType EdgeType, conditionedOn string) bool

type AuthorizationModelNode

type AuthorizationModelNode struct {
	graph.Node
	// contains filtered or unexported fields
}

func (*AuthorizationModelNode) Attributes

func (n *AuthorizationModelNode) Attributes() []encoding.Attribute

type EdgeType

type EdgeType int64
const (
	DirectEdge  EdgeType = 0
	RewriteEdge EdgeType = 1
	TTUEdge     EdgeType = 2
)

type NodeType

type NodeType int64
const (
	SpecificType            NodeType = 0 // e.g. `group`
	SpecificTypeAndRelation NodeType = 1 // e.g. `group#viewer`
	OperatorNode            NodeType = 2 // e.g. union
)

Jump to

Keyboard shortcuts

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