Merge pull request #18461 from nextcloud/fix/noid/ensure-entity-on-scope-extension

Flows that are managing themselves do not necessarily set the entity
This commit is contained in:
blizzz 2019-12-18 11:09:12 +01:00 committed by GitHub
commit 47a4a037ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -121,14 +121,16 @@ class RuleMatcher implements IRuleMatcher {
$operations = array_merge($operations, $this->manager->getOperations($class, $scope)); $operations = array_merge($operations, $this->manager->getOperations($class, $scope));
} }
$additionalScopes = $this->manager->getAllConfiguredScopesForOperation($class); if($this->entity instanceof IEntity) {
foreach ($additionalScopes as $hash => $scopeCandidate) { $additionalScopes = $this->manager->getAllConfiguredScopesForOperation($class);
/** @var ScopeContext $scopeCandidate */ foreach ($additionalScopes as $hash => $scopeCandidate) {
if ($scopeCandidate->getScope() !== IManager::SCOPE_USER || in_array($scopeCandidate, $scopes)) { /** @var ScopeContext $scopeCandidate */
continue; 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->isLegitimatedForUserId($scopeCandidate->getScopeId())) {
$operations = array_merge($operations, $this->manager->getOperations($class, $scopeCandidate));
}
} }
} }