summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/Service/RuleMatcher.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/lib/Service/RuleMatcher.php')
-rw-r--r--apps/workflowengine/lib/Service/RuleMatcher.php50
1 files changed, 49 insertions, 1 deletions
diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php
index 57e3813c309..d73fe752f74 100644
--- a/apps/workflowengine/lib/Service/RuleMatcher.php
+++ b/apps/workflowengine/lib/Service/RuleMatcher.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\WorkflowEngine\Service;
+use OCA\WorkflowEngine\Helper\LogContext;
use OCA\WorkflowEngine\Helper\ScopeContext;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\QueryException;
@@ -58,17 +59,21 @@ class RuleMatcher implements IRuleMatcher {
protected $operation;
/** @var IEntity */
protected $entity;
+ /** @var Logger */
+ protected $logger;
public function __construct(
IUserSession $session,
IServerContainer $container,
IL10N $l,
- Manager $manager
+ Manager $manager,
+ Logger $logger
) {
$this->session = $session;
$this->manager = $manager;
$this->container = $container;
$this->l = $l;
+ $this->logger = $logger;
}
public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void {
@@ -116,6 +121,13 @@ class RuleMatcher implements IRuleMatcher {
$scopes[] = new ScopeContext(IManager::SCOPE_USER, $user->getUID());
}
+ $ctx = new LogContext();
+ $ctx
+ ->setScopes($scopes)
+ ->setEntity($this->entity)
+ ->setOperation($this->operation);
+ $this->logger->logFlowRequests($ctx);
+
$operations = [];
foreach ($scopes as $scope) {
$operations = array_merge($operations, $this->manager->getOperations($class, $scope));
@@ -129,6 +141,12 @@ class RuleMatcher implements IRuleMatcher {
continue;
}
if ($this->entity->isLegitimatedForUserId($scopeCandidate->getScopeId())) {
+ $ctx = new LogContext();
+ $ctx
+ ->setScopes($scopeCandidate)
+ ->setEntity($this->entity)
+ ->setOperation($this->operation);
+ $this->logger->logScopeExpansion($ctx);
$operations = array_merge($operations, $this->manager->getOperations($class, $scopeCandidate));
}
}
@@ -146,12 +164,36 @@ class RuleMatcher implements IRuleMatcher {
}
}
+ $ctx = new LogContext();
+ $ctx
+ ->setEntity($this->entity)
+ ->setOperation($this->operation)
+ ->setConfiguration($operation);
+ $this->logger->logPassedCheck($ctx);
+
if ($returnFirstMatchingOperationOnly) {
+ $ctx = new LogContext();
+ $ctx
+ ->setEntity($this->entity)
+ ->setOperation($this->operation)
+ ->setConfiguration($operation);
+ $this->logger->logRunSingle($ctx);
return $operation;
}
$matches[] = $operation;
}
+ $ctx = new LogContext();
+ $ctx
+ ->setEntity($this->entity)
+ ->setOperation($this->operation);
+ if(!empty($matches)) {
+ $ctx->setConfiguration($matches);
+ $this->logger->logRunAll($ctx);
+ } else {
+ $this->logger->logRunNone($ctx);
+ }
+
return $matches;
}
@@ -183,4 +225,10 @@ class RuleMatcher implements IRuleMatcher {
}
return $checkInstance->executeCheck($check['operator'], $check['value']);
}
+
+ protected function logCandidate() {
+ $logContext = new LogContext();
+ $logContext
+ ->setOperation();
+ }
}