Add mount option to disable sharing

This commit is contained in:
Robin Appelman 2015-12-02 16:23:50 +01:00
parent b65a23ca4b
commit 3c8aac3867
2 changed files with 17 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")
@ -830,6 +835,7 @@ MountConfigListView.prototype = _.extend({
$tr.find('input.mountOptions').val(JSON.stringify({
'encrypt': true,
'previews': true,
'enable_sharing': true,
'filesystem_check_changes': 1
}));
}
@ -1172,7 +1178,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

@ -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()) {