aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/App/AppManager.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-09-25 14:08:34 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2023-10-19 22:04:20 +0200
commit08cff0777aac169dd9c758b73faa0060004fc7a0 (patch)
treec176bf2812e8a97d40cf94d8f0166a136911e30d /lib/private/App/AppManager.php
parenta6c450b481e439e23be166c84c6fcda45a6a2ebb (diff)
downloadnextcloud-server-08cff0777aac169dd9c758b73faa0060004fc7a0.tar.gz
nextcloud-server-08cff0777aac169dd9c758b73faa0060004fc7a0.zip
feat(IAppManager): Allow to set the (user) default apps and get all global default apps
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r--lib/private/App/AppManager.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index ccbb2143133..903e8c2993f 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -38,6 +38,7 @@
*/
namespace OC\App;
+use InvalidArgumentException;
use OC\AppConfig;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\ServerNotAvailableException;
@@ -859,4 +860,19 @@ class AppManager implements IAppManager {
return $appId;
}
+
+ public function getDefaultApps(): array {
+ return explode(',', $this->config->getSystemValueString('defaultapp', 'dashboard,files'));
+ }
+
+ public function setDefaultApps(array $defaultApps): void {
+ foreach ($defaultApps as $app) {
+ if (!$this->isInstalled($app)) {
+ $this->logger->debug('Can not set not installed app as default app', ['missing_app' => $app]);
+ throw new InvalidArgumentException('App is not installed');
+ }
+ }
+
+ $this->config->setSystemValue('defaultapp', join(',', $defaultApps));
+ }
}