Пример #1
0
 public static function checkProcessRules($roleId = null, $cacheConjuncts = true)
 {
     if (!is_null($roleId)) {
         $role = new Role($roleId);
         Notifications::addLog("------------------------- CHECKING PROCESS RULES (for role {$role->name}) -------------------------", 'RuleEngine');
         foreach ($role->maintains as $ruleName) {
             $rule = RuleEngine::getRule($ruleName);
             $violations = RuleEngine::checkRule($rule, $cacheConjuncts);
             foreach ((array) $violations as $violation) {
                 Notifications::addViolation($rule, $violation['src'], $violation['tgt']);
             }
         }
     } else {
         Notifications::addLog("------------------------- CHECKING ALL PROCESS RULES -------------------------", 'RuleEngine');
         foreach (RuleEngine::getAllProcessRuleNames() as $ruleName) {
             $rule = RuleEngine::getRule($ruleName);
             $violations = RuleEngine::checkRule($rule, $cacheConjuncts);
             foreach ((array) $violations as $violation) {
                 Notifications::addViolation($rule, $violation['src'], $violation['tgt']);
             }
         }
     }
 }