mirror of
https://github.com/nextcloud/server.git
synced 2024-08-22 05:55:27 +02:00
Verify that the encryption module exists before setting it
This commit is contained in:
parent
e58029f8ad
commit
a09df6d453
@ -101,17 +101,17 @@ class Manager implements IManager {
|
|||||||
throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
|
throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
$defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
|
|
||||||
|
|
||||||
if (empty($defaultEncryptionModuleId)) {
|
|
||||||
$this->setDefaultEncryptionModule($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->encryptionModules[$id] = [
|
$this->encryptionModules[$id] = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'displayName' => $displayName,
|
'displayName' => $displayName,
|
||||||
'callback' => $callback,
|
'callback' => $callback,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
|
||||||
|
|
||||||
|
if (empty($defaultEncryptionModuleId)) {
|
||||||
|
$this->setDefaultEncryptionModule($id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,6 +182,7 @@ class Manager implements IManager {
|
|||||||
*/
|
*/
|
||||||
public function setDefaultEncryptionModule($moduleId) {
|
public function setDefaultEncryptionModule($moduleId) {
|
||||||
try {
|
try {
|
||||||
|
$this->getEncryptionModule($moduleId);
|
||||||
$this->config->setAppValue('core', 'default_encryption_module', $moduleId);
|
$this->config->setAppValue('core', 'default_encryption_module', $moduleId);
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user