Skip to content

Commit

Permalink
Merge pull request #18461 from nextcloud/fix/noid/ensure-entity-on-sc…
Browse files Browse the repository at this point in the history
…ope-extension

Flows that are managing themselves do not necessarily set the entity
  • Loading branch information
blizzz authored Dec 18, 2019
2 parents 34c48aa + 0a00903 commit 47a4a03
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apps/workflowengine/lib/Service/RuleMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ public function getMatchingOperations(string $class, bool $returnFirstMatchingOp
$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));
}
}
}

Expand Down

0 comments on commit 47a4a03

Please sign in to comment.