summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/lib/Controller')
-rw-r--r--apps/provisioning_api/lib/Controller/AppConfigController.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php
index 6e61e10a2f2..eda46ee8e2c 100644
--- a/apps/provisioning_api/lib/Controller/AppConfigController.php
+++ b/apps/provisioning_api/lib/Controller/AppConfigController.php
@@ -106,7 +106,7 @@ class AppConfigController extends OCSController {
public function setValue(string $app, string $key, string $value): DataResponse {
try {
$this->verifyAppId($app);
- $this->verifyConfigKey($app, $key);
+ $this->verifyConfigKey($app, $key, $value);
} catch (\InvalidArgumentException $e) {
return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
}
@@ -124,7 +124,7 @@ class AppConfigController extends OCSController {
public function deleteKey(string $app, string $key): DataResponse {
try {
$this->verifyAppId($app);
- $this->verifyConfigKey($app, $key);
+ $this->verifyConfigKey($app, $key, '');
} catch (\InvalidArgumentException $e) {
return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
}
@@ -146,14 +146,19 @@ class AppConfigController extends OCSController {
/**
* @param string $app
* @param string $key
+ * @param string $value
* @throws \InvalidArgumentException
*/
- protected function verifyConfigKey(string $app, string $key) {
+ protected function verifyConfigKey(string $app, string $key, string $value) {
if (in_array($key, ['installed_version', 'enabled', 'types'])) {
throw new \InvalidArgumentException('The given key can not be set');
}
- if ($app === 'core' && ($key === 'encryption_enabled' || strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) {
+ if ($app === 'core' && $key === 'encryption_enabled' && $value !== 'yes') {
+ throw new \InvalidArgumentException('The given key can not be set');
+ }
+
+ if ($app === 'core' && (strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) {
throw new \InvalidArgumentException('The given key can not be set');
}
}