]> source.dussan.org Git - nextcloud-server.git/commitdiff
Disable sharing by default for external storage mounts
authorVincent Petry <pvince81@owncloud.com>
Tue, 23 Feb 2016 14:16:13 +0000 (15:16 +0100)
committerVincent Petry <pvince81@owncloud.com>
Wed, 24 Feb 2016 12:58:21 +0000 (13:58 +0100)
This is for newly created mount points.

Migrated mount points will have sharing enabled as before.

apps/files_external/js/settings.js
apps/files_external/lib/storageconfig.php
apps/files_external/migration/storagemigrator.php
apps/files_external/tests/js/settingsSpec.js

index 26df203091e33512d63e99e1df553214b899a77e..96b56d221c5f39e71751749bce4b6f90f2eef172 100644 (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
                        }));
                }
index 6f44b25a2e6478f825c45ffdc46c0990f51a343c..42c515f46719b28bee8b9eefe0f610dbb34c01b2 100644 (file)
@@ -126,6 +126,7 @@ class StorageConfig implements \JsonSerializable {
         */
        public function __construct($id = null) {
                $this->id = $id;
+               $this->mountOptions['enable_sharing'] = false;
        }
 
        /**
index ba81810a4fd2d5a2e9f9460f3d099f6a55ec888e..832807feb93c5b373e5493d9652f99206986cda2 100644 (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();
index 6f5bb2a8e3ed5994fc0ef6976fb335edec4c2d43..2a7afd6c2fa84a8d67be609b13e4ef06e0adcb07 100644 (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
                                });
                        });