countModelRules counts the total number of rules in a model's p and g sections.
(m model.Model)
| 48 | |
| 49 | // countModelRules counts the total number of rules in a model's p and g sections. |
| 50 | func countModelRules(m model.Model) int { |
| 51 | ruleCount := 0 |
| 52 | if pSection, ok := m["p"]; ok { |
| 53 | for _, ast := range pSection { |
| 54 | ruleCount += len(ast.Policy) |
| 55 | } |
| 56 | } |
| 57 | if gSection, ok := m["g"]; ok { |
| 58 | for _, ast := range gSection { |
| 59 | ruleCount += len(ast.Policy) |
| 60 | } |
| 61 | } |
| 62 | return ruleCount |
| 63 | } |
| 64 | |
| 65 | // onLogBeforeEventInLoadPolicy initializes logging for LoadPolicy operation. |
| 66 | func (e *Enforcer) onLogBeforeEventInLoadPolicy() *log.LogEntry { |
no outgoing calls
no test coverage detected
searching dependent graphs…