summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-11-27 13:59:34 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-11-28 13:51:16 +0100
commit7210852f075085ab2d678f9554125dedc7e3a310 (patch)
treeeda518853a0a3c9cbcc0919f8e4cc1991e384bbf /lib
parent6b97f6af48ba8dc029e616cf778a1cbcd0fea001 (diff)
downloadnextcloud-server-7210852f075085ab2d678f9554125dedc7e3a310.tar.gz
nextcloud-server-7210852f075085ab2d678f9554125dedc7e3a310.zip
allow user flows when the acting user is legitimate, but not its owner
for instance, when a sharee changes a file, the owner can act upon Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/WorkflowEngine/IEntity.php8
-rw-r--r--lib/public/WorkflowEngine/IRuleMatcher.php31
2 files changed, 39 insertions, 0 deletions
diff --git a/lib/public/WorkflowEngine/IEntity.php b/lib/public/WorkflowEngine/IEntity.php
index b8205600498..47e2f102199 100644
--- a/lib/public/WorkflowEngine/IEntity.php
+++ b/lib/public/WorkflowEngine/IEntity.php
@@ -74,4 +74,12 @@ interface IEntity {
*/
public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void;
+ /**
+ * returns whether the provided user id is allowed to run a flow against
+ * the known context
+ *
+ * @since 18.0.0
+ */
+ public function isLegitimatedForUserId(string $userId): bool;
+
}
diff --git a/lib/public/WorkflowEngine/IRuleMatcher.php b/lib/public/WorkflowEngine/IRuleMatcher.php
index 5569800edb7..fa2359edc09 100644
--- a/lib/public/WorkflowEngine/IRuleMatcher.php
+++ b/lib/public/WorkflowEngine/IRuleMatcher.php
@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace OCP\WorkflowEngine;
+use RuntimeException;
+
/**
* Class IRuleMatcher
*
@@ -33,7 +35,36 @@ namespace OCP\WorkflowEngine;
*/
interface IRuleMatcher extends IFileCheck {
/**
+ * This method is left for backwards compatibility and easier porting of
+ * apps. Please use 'getFlows' instead (and setOperation if you implement
+ * an IComplexOperation).
+ *
* @since 18.0.0
+ * @deprecated 18.0.0
*/
public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array;
+
+ /**
+ * @throws RuntimeException
+ * @since 18.0.0
+ */
+ public function getFlows(bool $returnFirstMatchingOperationOnly = true): array;
+
+ /**
+ * this method can only be called once and is typically called by the
+ * Flow engine, unless for IComplexOperations.
+ *
+ * @throws RuntimeException
+ * @since 18.0.0
+ */
+ public function setOperation(IOperation $operation): void;
+
+ /**
+ * this method can only be called once and is typically called by the
+ * Flow engine, unless for IComplexOperations.
+ *
+ * @throws RuntimeException
+ * @since 18.0.0
+ */
+ public function setEntity(IEntity $entity): void;
}