From 0a00903261425caac68fd95b996f3051e6776754 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 18 Dec 2019 09:35:03 +0100 Subject: [PATCH] Flows that are managing themselves do not necessarily set the entity for instance files_automatedtagging, which works on a lower level. Fixes a Call to a member function isLegitimatedForUserId() on null. Signed-off-by: Arthur Schiwon --- .../workflowengine/lib/Service/RuleMatcher.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php index 6186df1d7b..57e3813c30 100644 --- a/apps/workflowengine/lib/Service/RuleMatcher.php +++ b/apps/workflowengine/lib/Service/RuleMatcher.php @@ -121,14 +121,16 @@ class RuleMatcher implements IRuleMatcher { $operations = array_merge($operations, $this->manager->getOperations($class, $scope)); } - $additionalScopes = $this->manager->getAllConfiguredScopesForOperation($class); - foreach ($additionalScopes as $hash => $scopeCandidate) { - /** @var ScopeContext $scopeCandidate */ - if ($scopeCandidate->getScope() !== IManager::SCOPE_USER || in_array($scopeCandidate, $scopes)) { - continue; - } - if ($this->entity->isLegitimatedForUserId($scopeCandidate->getScopeId())) { - $operations = array_merge($operations, $this->manager->getOperations($class, $scopeCandidate)); + if($this->entity instanceof IEntity) { + $additionalScopes = $this->manager->getAllConfiguredScopesForOperation($class); + foreach ($additionalScopes as $hash => $scopeCandidate) { + /** @var ScopeContext $scopeCandidate */ + if ($scopeCandidate->getScope() !== IManager::SCOPE_USER || in_array($scopeCandidate, $scopes)) { + continue; + } + if ($this->entity->isLegitimatedForUserId($scopeCandidate->getScopeId())) { + $operations = array_merge($operations, $this->manager->getOperations($class, $scopeCandidate)); + } } }