mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
feat(IAppManager): Allow to set the (user) default apps and get all global default apps
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
a6c450b481
commit
08cff0777a
2 changed files with 33 additions and 0 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,4 +251,21 @@ interface IAppManager {
|
|||
* @since 25.0.6
|
||||
*/
|
||||
public function getDefaultAppForUser(?IUser $user = null): string;
|
||||
|
||||
/**
|
||||
* Get the global default apps with fallbacks
|
||||
*
|
||||
* @return string[] The default applications
|
||||
* @since 28.0.0
|
||||
*/
|
||||
public function getDefaultApps(): array;
|
||||
|
||||
/**
|
||||
* Set the global default apps with fallbacks
|
||||
*
|
||||
* @param string[] $appId
|
||||
* @throws \InvalidArgumentException If any of the apps is not installed
|
||||
* @since 28.0.0
|
||||
*/
|
||||
public function setDefaultApps(array $defaultApps): void;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue