MCPcopy
hub / github.com/apache/caldera / is_fact_allowed

Method is_fact_allowed

app/utility/rule_set.py:15–23  ·  view source on GitHub ↗
(self, fact)

Source from the content-addressed store, hash-verified

13 self.rules = rules
14
15 async def is_fact_allowed(self, fact):
16 allowed = True
17 for rule in await self._applicable_rules(fact):
18 if await self._is_ip_rule_match(rule, fact):
19 allowed = await self._rule_judgement(rule.action)
20 continue
21 if await self._is_regex_rule_match(rule, fact):
22 allowed = await self._rule_judgement(rule.action)
23 return allowed
24
25 async def _applicable_rules(self, fact):
26 applicable_rules = []

Callers 5

apply_rulesMethod · 0.95
test_is_fact_allowedMethod · 0.80
test_smaller_subnetMethod · 0.80
test_larger_subnetMethod · 0.80
test_same_subnetMethod · 0.80

Calls 4

_applicable_rulesMethod · 0.95
_is_ip_rule_matchMethod · 0.95
_rule_judgementMethod · 0.95
_is_regex_rule_matchMethod · 0.95

Tested by 4

test_is_fact_allowedMethod · 0.64
test_smaller_subnetMethod · 0.64
test_larger_subnetMethod · 0.64
test_same_subnetMethod · 0.64