Merge pull request #20903 from owncloud/sharing-mount-option

Add mount option to disable sharing
This commit is contained in:
Thomas Müller 2016-02-02 10:26:24 +01:00
commit 4777f78187
3 changed files with 18 additions and 1 deletions

View File

@ -23,6 +23,10 @@ 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"/>' +
' <label for="mountOptionsSharing">{{t "files_external" "Enable sharing"}}</label>' +
' </div>' +
' <div class="optionRow">' +
' <label for="mountOptionsFilesystemCheck">{{t "files_external" "Check for changes"}}</label>' +
' <select id="mountOptionsFilesystemCheck" name="filesystem_check_changes" data-type="int">' +
' <option value="0">{{t "files_external" "Never"}}</option>' +
@ -35,6 +39,7 @@ var MOUNT_OPTIONS_DROPDOWN_TEMPLATE =
templates therefore they are duplicated here
t("files_external", "Enable encryption")
t("files_external", "Enable previews")
t("files_external", "Enable sharing")
t("files_external", "Check for changes")
t("files_external", "Never")
t("files_external", "Once every direct access")
@ -870,6 +875,7 @@ MountConfigListView.prototype = _.extend({
$tr.find('input.mountOptions').val(JSON.stringify({
'encrypt': true,
'previews': true,
'enable_sharing': true,
'filesystem_check_changes': 1
}));
}
@ -1245,7 +1251,7 @@ MountConfigListView.prototype = _.extend({
var storage = this.getStorageConfig($tr);
var $toggle = $tr.find('.mountOptionsToggle');
var dropDown = new MountOptionsDropdown();
var enabledOptions = ['previews', 'filesystem_check_changes'];
var enabledOptions = ['previews', 'filesystem_check_changes', 'enable_sharing'];
if (this._encryptionEnabled) {
enabledOptions.push('encrypt');
}

View File

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

View File

@ -152,6 +152,16 @@ class OC_Util {
return $storage;
});
\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
if (!$mount->getOption('enable_sharing', true)) {
return new \OC\Files\Storage\Wrapper\PermissionsMask([
'storage' => $storage,
'mask' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE
]);
}
return $storage;
});
// install storage availability wrapper, before most other wrappers
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
if (!$storage->isLocal()) {