mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Prevent objectstore being set from client side
This commit is contained in:
parent
494c1d7417
commit
63218ec098
2 changed files with 16 additions and 2 deletions
|
|
@ -138,6 +138,16 @@ abstract class StoragesController extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
if ($storage->getBackendOption('objectstore')) {
|
||||
// objectstore must not be sent from client side
|
||||
return new DataResponse(
|
||||
array(
|
||||
'message' => (string)$this->l10n->t('Objectstore forbidden')
|
||||
),
|
||||
Http::STATUS_UNPROCESSABLE_ENTITY
|
||||
);
|
||||
}
|
||||
|
||||
/** @var Backend */
|
||||
$backend = $storage->getBackend();
|
||||
/** @var AuthMechanism */
|
||||
|
|
|
|||
|
|
@ -472,10 +472,14 @@ abstract class StoragesService {
|
|||
if (!isset($allStorages[$id])) {
|
||||
throw new NotFoundException('Storage with id "' . $id . '" not found');
|
||||
}
|
||||
|
||||
$oldStorage = $allStorages[$id];
|
||||
$allStorages[$id] = $updatedStorage;
|
||||
|
||||
// ensure objectstore is persistent
|
||||
if ($objectstore = $oldStorage->getBackendOption('objectstore')) {
|
||||
$updatedStorage->setBackendOption('objectstore', $objectstore);
|
||||
}
|
||||
|
||||
$allStorages[$id] = $updatedStorage;
|
||||
$this->writeConfig($allStorages);
|
||||
|
||||
$this->triggerChangeHooks($oldStorage, $updatedStorage);
|
||||
|
|
|
|||
Loading…
Reference in a new issue