Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-08-26 21:22:37 +0300
committerGitHub <noreply@github.com>2020-08-26 21:22:37 +0300
commitc9a1379bdf99013c7f0bf9510f0e9f7955100ff7 (patch)
tree20b2dca6e0cc5c63edd9f1ccf02adba31e10592b /apps
parent7aeb2224261e21160bdbf0bbb1b7f6ec0e3c7b6a (diff)
parentf8417cca0f1ac429041784af5417062a781f7d3e (diff)
Merge pull request #22410 from nextcloud/backport/22359/stable19
[stable19] fix possible leaking scope in Flow
Diffstat (limited to 'apps')
-rw-r--r--apps/workflowengine/lib/AppInfo/Application.php1
-rw-r--r--apps/workflowengine/lib/Service/RuleMatcher.php14
2 files changed, 15 insertions, 0 deletions
diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php
index 70b5468c553..57cfee7f1a0 100644
--- a/apps/workflowengine/lib/AppInfo/Application.php
+++ b/apps/workflowengine/lib/AppInfo/Application.php
@@ -95,6 +95,7 @@ class Application extends \OCP\AppFramework\App {
/** @var IOperation $operation */
$operation = $this->getContainer()->query($operationClass);
+ $ruleMatcher->setEventName($eventName);
$ruleMatcher->setEntity($entity);
$ruleMatcher->setOperation($operation);
diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php
index f02c28fa27e..6bad3cefd5d 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);