diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-02-23 15:16:13 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-02-24 13:58:21 +0100 |
commit | 4829a2d421902e0edede30a71c96a86c576a17b1 (patch) | |
tree | 4fe9dc440688ac6c2160850e7d8f0d46dc77daf4 /apps | |
parent | fae6643e6dd4bc308170e0ab45886f110f60a639 (diff) | |
download | nextcloud-server-4829a2d421902e0edede30a71c96a86c576a17b1.tar.gz nextcloud-server-4829a2d421902e0edede30a71c96a86c576a17b1.zip |
Disable sharing by default for external storage mounts
This is for newly created mount points.
Migrated mount points will have sharing enabled as before.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/js/settings.js | 4 | ||||
-rw-r--r-- | apps/files_external/lib/storageconfig.php | 1 | ||||
-rw-r--r-- | apps/files_external/migration/storagemigrator.php | 6 | ||||
-rw-r--r-- | apps/files_external/tests/js/settingsSpec.js | 2 |
4 files changed, 10 insertions, 3 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 26df203091e..96b56d221c5 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -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 })); } diff --git a/apps/files_external/lib/storageconfig.php b/apps/files_external/lib/storageconfig.php index 6f44b25a2e6..42c515f4671 100644 --- a/apps/files_external/lib/storageconfig.php +++ b/apps/files_external/lib/storageconfig.php @@ -126,6 +126,7 @@ class StorageConfig implements \JsonSerializable { */ public function __construct($id = null) { $this->id = $id; + $this->mountOptions['enable_sharing'] = false; } /** diff --git a/apps/files_external/migration/storagemigrator.php b/apps/files_external/migration/storagemigrator.php index ba81810a4fd..832807feb93 100644 --- a/apps/files_external/migration/storagemigrator.php +++ b/apps/files_external/migration/storagemigrator.php @@ -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(); diff --git a/apps/files_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js index 6f5bb2a8e3e..2a7afd6c2fa 100644 --- a/apps/files_external/tests/js/settingsSpec.js +++ b/apps/files_external/tests/js/settingsSpec.js @@ -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 }); }); |