diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-10 00:52:27 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-10 00:52:27 +0200 |
commit | d36365413210fc3adfd1214b174e68d8a340ee96 (patch) | |
tree | 596605f297ed7ac7eb77425bd10c6d42c46114f6 /apps/workflowengine/lib | |
parent | 5610f73b7a57c733f437c9b374b5c1d705bd95ed (diff) | |
download | nextcloud-server-d36365413210fc3adfd1214b174e68d8a340ee96.tar.gz nextcloud-server-d36365413210fc3adfd1214b174e68d8a340ee96.zip |
fix order/entity types when setting the context
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/workflowengine/lib')
-rw-r--r-- | apps/workflowengine/lib/Service/RuleMatcher.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php index bc92eeee818..bcfcd5dd219 100644 --- a/apps/workflowengine/lib/Service/RuleMatcher.php +++ b/apps/workflowengine/lib/Service/RuleMatcher.php @@ -36,6 +36,7 @@ use OCP\IServerContainer; use OCP\IUserSession; use OCP\WorkflowEngine\ICheck; use OCP\WorkflowEngine\IEntity; +use OCP\WorkflowEngine\IEntityCheck; use OCP\WorkflowEngine\IFileCheck; use OCP\WorkflowEngine\IManager; use OCP\WorkflowEngine\IRuleMatcher; @@ -117,21 +118,20 @@ class RuleMatcher implements IRuleMatcher { return true; } - if ($checkInstance instanceof ICheck) { + if ($checkInstance instanceof IFileCheck) { + if (empty($this->fileInfo)) { + throw new \RuntimeException('Must set file info before running the check'); + } + $checkInstance->setFileInfo($this->fileInfo['storage'], $this->fileInfo['path']); + } elseif ($checkInstance instanceof IEntityCheck) { foreach($this->contexts as $entityInfo) { list($entity, $subject) = $entityInfo; $checkInstance->setEntitySubject($entity, $subject); } - return $checkInstance->executeCheck($check['operator'], $check['value']); - } elseif ($checkInstance instanceof IFileCheck) { - if(empty($this->fileInfo)) { - throw new \RuntimeException('Must set file info before running the check'); - } - $checkInstance->setFileInfo($this->fileInfo['storage'], $this->fileInfo['path']); - return $checkInstance->executeCheck($check['operator'], $check['value']); } else { // Check is invalid throw new \UnexpectedValueException($this->l->t('Check %s is invalid or does not exist', $check['class'])); } + return $checkInstance->executeCheck($check['operator'], $check['value']); } } |