Merge pull request #18558 from owncloud/ext-objectstore

Prevent objectstore being set from client side
This commit is contained in:
Lukas Reschke 2015-08-25 20:56:51 +02:00
commit e2bd026b2e
2 changed files with 16 additions and 2 deletions

View File

@ -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 */ /** @var Backend */
$backend = $storage->getBackend(); $backend = $storage->getBackend();
/** @var AuthMechanism */ /** @var AuthMechanism */

View File

@ -472,10 +472,14 @@ abstract class StoragesService {
if (!isset($allStorages[$id])) { if (!isset($allStorages[$id])) {
throw new NotFoundException('Storage with id "' . $id . '" not found'); throw new NotFoundException('Storage with id "' . $id . '" not found');
} }
$oldStorage = $allStorages[$id]; $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->writeConfig($allStorages);
$this->triggerChangeHooks($oldStorage, $updatedStorage); $this->triggerChangeHooks($oldStorage, $updatedStorage);