diff options
-rw-r--r-- | settings/Controller/AppSettingsController.php | 21 | ||||
-rw-r--r-- | settings/routes.php | 3 |
2 files changed, 15 insertions, 9 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 413e54d6ce4..98835dc583e 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -187,7 +187,7 @@ class AppSettingsController extends Controller { * @param string $requestedCategory * @return array */ - private function getAppsForCategory($requestedCategory) { + private function getAppsForCategory($requestedCategory = '') { $versionParser = new VersionParser(); $formattedApps = []; $apps = $this->appFetcher->get(); @@ -197,14 +197,16 @@ class AppSettingsController extends Controller { } // Skip all apps not in the requested category - $isInCategory = false; - foreach($app['categories'] as $category) { - if($category === $requestedCategory) { - $isInCategory = true; + if ($requestedCategory !== '') { + $isInCategory = false; + foreach($app['categories'] as $category) { + if($category === $requestedCategory) { + $isInCategory = true; + } + } + if(!$isInCategory) { + continue; } - } - if(!$isInCategory) { - continue; } $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); @@ -496,9 +498,10 @@ class AppSettingsController extends Controller { * @PasswordConfirmationRequired * * @param string $appId + * @param array $groups * @return JSONResponse */ - public function enableApp(string $appId, array $groups): JSONResponse { + public function enableApp(string $appId, array $groups = []): JSONResponse { return $this->enableApps([$appId], $groups); } diff --git a/settings/routes.php b/settings/routes.php index 29db7c06d4e..e0c0eb3d9bf 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -51,7 +51,10 @@ $application->registerRoutes($this, [ ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET'], ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}', 'verb' => 'GET', 'defaults' => ['category' => '']], + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}/{id}', 'verb' => 'GET', 'defaults' => ['category' => '', 'id' => '']], + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'GET'], + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'POST'], ['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST'], ['name' => 'AppSettings#disableApp', 'url' => '/settings/apps/disable/{appId}', 'verb' => 'GET'], ['name' => 'AppSettings#disableApps', 'url' => '/settings/apps/disable', 'verb' => 'POST'], |