diff options
author | provokateurin <kate@provokateurin.de> | 2024-08-27 09:00:09 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-08-27 10:51:52 +0000 |
commit | c0f89e8b5f8879dcd5c046a21b49c70870111388 (patch) | |
tree | 8bd9889a92a85db5777d895351589caf394a18d4 | |
parent | fc9da19b996451cc59b49233a0d1cdd07699d235 (diff) | |
download | nextcloud-server-c0f89e8b5f8879dcd5c046a21b49c70870111388.tar.gz nextcloud-server-c0f89e8b5f8879dcd5c046a21b49c70870111388.zip |
fix(Router): Load attribute routes of all apps when not app is specified
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r-- | lib/private/Route/Router.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index b04b6a4d21c..646d1d4e6ed 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -111,9 +111,14 @@ class Router implements IRouter { if ($this->loaded) { return; } + $this->eventLogger->start('route:load:' . $requestedApp, 'Loading Routes for ' . $requestedApp); if (is_null($app)) { $this->loaded = true; $routingFiles = $this->getRoutingFiles(); + + foreach (\OC_App::getEnabledApps() as $enabledApp) { + $this->loadAttributeRoutes($enabledApp); + } } else { if (isset($this->loadedApps[$app])) { return; @@ -125,21 +130,9 @@ class Router implements IRouter { } else { $routingFiles = []; } - } - $this->eventLogger->start('route:load:' . $requestedApp, 'Loading Routes for ' . $requestedApp); - - if ($requestedApp !== null && in_array($requestedApp, \OC_App::getEnabledApps())) { - $routes = $this->getAttributeRoutes($requestedApp); - if (count($routes) > 0) { - $this->useCollection($requestedApp); - $this->setupRoutes($routes, $requestedApp); - $collection = $this->getCollection($requestedApp); - $this->root->addCollection($collection); - // Also add the OCS collection - $collection = $this->getCollection($requestedApp . '.ocs'); - $collection->addPrefix('/ocsapp'); - $this->root->addCollection($collection); + if ($this->appManager->isEnabledForUser($app)) { + $this->loadAttributeRoutes($app); } } @@ -413,6 +406,23 @@ class Router implements IRouter { return $routeName; } + private function loadAttributeRoutes(string $app): void { + $routes = $this->getAttributeRoutes($app); + if (count($routes) === 0) { + return; + } + + $this->useCollection($app); + $this->setupRoutes($routes, $app); + $collection = $this->getCollection($app); + $this->root->addCollection($collection); + + // Also add the OCS collection + $collection = $this->getCollection($app . '.ocs'); + $collection->addPrefix('/ocsapp'); + $this->root->addCollection($collection); + } + /** * @throws ReflectionException */ |