aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/Service
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/lib/Service')
-rw-r--r--apps/workflowengine/lib/Service/RuleMatcher.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php
index 05ea16d6816..0ae26627427 100644
--- a/apps/workflowengine/lib/Service/RuleMatcher.php
+++ b/apps/workflowengine/lib/Service/RuleMatcher.php
@@ -62,6 +62,8 @@ class RuleMatcher implements IRuleMatcher {
protected $entity;
/** @var Logger */
protected $logger;
+ /** @var string */
+ protected $eventName;
public function __construct(
IUserSession $session,
@@ -101,6 +103,13 @@ class RuleMatcher implements IRuleMatcher {
$this->entity = $entity;
}
+ public function setEventName(string $eventName): void {
+ if ($this->eventName !== null) {
+ throw new RuntimeException('This method must not be called more than once');
+ }
+ $this->eventName = $eventName;
+ }
+
public function getEntity(): IEntity {
if ($this->entity === null) {
throw new \LogicException('Entity was not set yet');
@@ -155,6 +164,11 @@ class RuleMatcher implements IRuleMatcher {
$matches = [];
foreach ($operations as $operation) {
+ $configuredEvents = json_decode($operation['events'], true);
+ if ($this->eventName !== null && !in_array($this->eventName, $configuredEvents)) {
+ continue;
+ }
+
$checkIds = json_decode($operation['checks'], true);
$checks = $this->manager->getChecks($checkIds);