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)
| 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. |
| 123 | func (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. |
no test coverage detected