diff options
author | Joas Schilling <coding@schilljs.com> | 2024-08-22 08:02:15 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-08-22 08:02:15 +0200 |
commit | 96414330011636ce89a58365428bdc9de6059042 (patch) | |
tree | 08d5ecd1d12da48f1ec0ce9009b83d81c5ce25d7 /apps/provisioning_api/lib | |
parent | b33260a22c7099e15903f2f9cf8f27d64680d663 (diff) | |
download | nextcloud-server-96414330011636ce89a58365428bdc9de6059042.tar.gz nextcloud-server-96414330011636ce89a58365428bdc9de6059042.zip |
fix(provisioning): Support setting new app configs as well
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/AppConfigController.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php index 2ea4602883c..2ff82213997 100644 --- a/apps/provisioning_api/lib/Controller/AppConfigController.php +++ b/apps/provisioning_api/lib/Controller/AppConfigController.php @@ -15,6 +15,7 @@ use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; +use OCP\Exceptions\AppConfigUnknownKeyException; use OCP\IAppConfig; use OCP\IGroupManager; use OCP\IL10N; @@ -126,9 +127,15 @@ class AppConfigController extends OCSController { return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN); } - $configDetails = $this->appConfig->getDetails($app, $key); + $type = null; + try { + $configDetails = $this->appConfig->getDetails($app, $key); + $type = $configDetails['type']; + } catch (AppConfigUnknownKeyException) { + } + /** @psalm-suppress InternalMethod */ - match ($configDetails['type']) { + match ($type) { IAppConfig::VALUE_BOOL => $this->appConfig->setValueBool($app, $key, (bool)$value), IAppConfig::VALUE_FLOAT => $this->appConfig->setValueFloat($app, $key, (float)$value), IAppConfig::VALUE_INT => $this->appConfig->setValueInt($app, $key, (int)$value), |