Disable sharing by default for external storage mounts

This is for newly created mount points.

Migrated mount points will have sharing enabled as before.
This commit is contained in:
Vincent Petry 2016-02-23 15:16:13 +01:00
parent fae6643e6d
commit 4829a2d421
4 changed files with 10 additions and 3 deletions

View File

@ -23,7 +23,7 @@ var MOUNT_OPTIONS_DROPDOWN_TEMPLATE =
' <label for="mountOptionsPreviews">{{t "files_external" "Enable previews"}}</label>' +
' </div>' +
' <div class="optionRow">' +
' <input id="mountOptionsSharing" name="enable_sharing" type="checkbox" value="true" checked="checked"/>' +
' <input id="mountOptionsSharing" name="enable_sharing" type="checkbox" value="true"/>' +
' <label for="mountOptionsSharing">{{t "files_external" "Enable sharing"}}</label>' +
' </div>' +
' <div class="optionRow">' +
@ -888,7 +888,7 @@ MountConfigListView.prototype = _.extend({
$tr.find('input.mountOptions').val(JSON.stringify({
'encrypt': true,
'previews': true,
'enable_sharing': true,
'enable_sharing': false,
'filesystem_check_changes': 1
}));
}

View File

@ -126,6 +126,7 @@ class StorageConfig implements \JsonSerializable {
*/
public function __construct($id = null) {
$this->id = $id;
$this->mountOptions['enable_sharing'] = false;
}
/**

View File

@ -100,6 +100,12 @@ class StorageMigrator {
$this->connection->beginTransaction();
try {
foreach ($existingStorage as $storage) {
$mountOptions = $storage->getMountOptions();
if (!empty($mountOptions) && !isset($mountOptions['enable_sharing'])) {
// existing mounts must have sharing enabled by default to avoid surprises
$mountOptions['enable_sharing'] = true;
$storage->setMountOptions($mountOptions);
}
$storageService->addStorage($storage);
}
$this->connection->commit();

View File

@ -363,7 +363,7 @@ describe('OCA.External.Settings tests', function() {
expect(JSON.parse($tr.find('input.mountOptions').val())).toEqual({
encrypt: true,
previews: true,
enable_sharing: true,
enable_sharing: false,
filesystem_check_changes: 0
});
});