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
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-05 16:52:11 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 23:56:04 +0300
commitc2a52813e2cfadc43b096927ee9d9db3d9ac5c84 (patch)
treefffa2234b146bd5fbda576ad1a73b7b01575de4f /lib/public/WorkflowEngine
parentd2c8b939d58239a99163445b83d80873932a5514 (diff)
extends ICheck with scope and entity support, provide them as initialState
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/public/WorkflowEngine')
-rw-r--r--lib/public/WorkflowEngine/ICheck.php24
-rw-r--r--lib/public/WorkflowEngine/IManager.php17
2 files changed, 37 insertions, 4 deletions
diff --git a/lib/public/WorkflowEngine/ICheck.php b/lib/public/WorkflowEngine/ICheck.php
index 1d4fc966460..92ec6f83893 100644
--- a/lib/public/WorkflowEngine/ICheck.php
+++ b/lib/public/WorkflowEngine/ICheck.php
@@ -55,4 +55,28 @@ interface ICheck {
* @since 9.1
*/
public function validateCheck($operator, $value);
+
+ /**
+ * returns a list of Entities the checker supports. The values must match
+ * the class name of the entity.
+ *
+ * An empty result means the check is universally available.
+ *
+ * @since 18.0.0
+ */
+ public function supportedEntities(): array;
+
+ /**
+ * returns whether the operation can be used in the requested scope.
+ *
+ * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At
+ * time of writing these are SCOPE_ADMIN and SCOPE_USER.
+ *
+ * For possibly unknown future scopes the recommended behaviour is: if
+ * user scope is permitted, the default behaviour should return `true`,
+ * otherwise `false`.
+ *
+ * @since 18.0.0
+ */
+ public function isAvailableForScope(int $scope): bool;
}
diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php
index 8ef7a3a03e8..8be47d961e7 100644
--- a/lib/public/WorkflowEngine/IManager.php
+++ b/lib/public/WorkflowEngine/IManager.php
@@ -39,6 +39,7 @@ interface IManager {
const EVENT_NAME_REG_OPERATION = 'OCP\WorkflowEngine::registerOperations';
const EVENT_NAME_REG_ENTITY = 'OCP\WorkflowEngine::registerEntities';
+ const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks';
/**
* @param IStorage $storage
@@ -56,18 +57,26 @@ interface IManager {
public function getMatchingOperations($class, $returnFirstMatchingOperationOnly = true);
/**
- * Listen to 'OCP/WorkflowEngine::registerEntities' at the EventDispatcher
- * for registering your entities
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_ENTITY` at the
+ * EventDispatcher for registering your entities.
*
* @since 18.0.0
*/
public function registerEntity(IEntity $entity): void;
/**
- * Listen to 'OCP/WorkflowEngine::registerOperators' at the EventDispatcher
- * for registering your operators
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_OPERATION` at the
+ * EventDispatcher for registering your operators.
*
* @since 18.0.0
*/
public function registerOperation(IOperation $operator): void;
+
+ /**
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_CHECK` at the
+ * EventDispatcher for registering your operators.
+ *
+ * @since 18.0.0
+ */
+ public function registerCheck(ICheck $check): void;
}