diff options
author | Joas Schilling <coding@schilljs.com> | 2023-02-15 15:36:32 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-02-23 06:13:00 +0100 |
commit | 15fc42966c7788aaf372514b3e0a9a8b1847d26a (patch) | |
tree | 5e9c5e805b62297800e2133031a2e5fed6b8ba89 /apps/workflowengine/lib | |
parent | c6700150d53423f64c7608f757d3839b84e3932a (diff) | |
download | nextcloud-server-15fc42966c7788aaf372514b3e0a9a8b1847d26a.tar.gz nextcloud-server-15fc42966c7788aaf372514b3e0a9a8b1847d26a.zip |
Also check the scope when reading operations from the database
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/workflowengine/lib')
-rw-r--r-- | apps/workflowengine/lib/Manager.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 7ef913bb1a5..674cfc65313 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -200,6 +200,13 @@ class Manager implements IManager { return $scopesByOperation[$operationClass]; } + try { + /** @var IOperation $operation */ + $operation = $this->container->query($operationClass); + } catch (QueryException $e) { + return []; + } + $query = $this->connection->getQueryBuilder(); $query->selectDistinct('s.type') @@ -214,6 +221,11 @@ class Manager implements IManager { $scopesByOperation[$operationClass] = []; while ($row = $result->fetch()) { $scope = new ScopeContext($row['type'], $row['value']); + + if (!$operation->isAvailableForScope((int) $row['type'])) { + continue; + } + $scopesByOperation[$operationClass][$scope->getHash()] = $scope; } @@ -243,6 +255,17 @@ class Manager implements IManager { $this->operations[$scopeContext->getHash()] = []; while ($row = $result->fetch()) { + try { + /** @var IOperation $operation */ + $operation = $this->container->query($row['class']); + } catch (QueryException $e) { + continue; + } + + if (!$operation->isAvailableForScope((int) $row['scope_type'])) { + continue; + } + if (!isset($this->operations[$scopeContext->getHash()][$row['class']])) { $this->operations[$scopeContext->getHash()][$row['class']] = []; } |