MCPcopy Create free account
hub / github.com/Permify/permify / RuleToGraph

Method RuleToGraph

pkg/development/graph/schema.go:123–135  ·  view source on GitHub ↗

RuleToGraph converts a RuleDefinition into a graph. It takes a RuleDefinition as input and constructs a graph representing the rule. The graph consists of a single node representing the rule itself.

(rule *base.RuleDefinition)

Source from the content-addressed store, hash-verified

121// It takes a RuleDefinition as input and constructs a graph representing the rule.
122// The graph consists of a single node representing the rule itself.
123func (b Builder) RuleToGraph(rule *base.RuleDefinition) (g Graph, err error) {
124 // Create a node for the rule
125 enNode := &Node{
126 Type: "rule",
127 ID: rule.GetName(),
128 Label: rule.GetName(),
129 }
130
131 // Add the rule node to the graph
132 g.AddNode(enNode)
133
134 return g, err
135}
136
137// buildPermissionGraph recursively builds a permission graph.
138// It takes an entity definition, a starting node, and a list of children as input.

Callers 1

SchemaToGraphMethod · 0.95

Calls 2

AddNodeMethod · 0.80
GetNameMethod · 0.65

Tested by

no test coverage detected