Add mount option to disable sharing
This commit is contained in:
parent
b65a23ca4b
commit
3c8aac3867
|
@ -23,6 +23,10 @@ var MOUNT_OPTIONS_DROPDOWN_TEMPLATE =
|
||||||
' <label for="mountOptionsPreviews">{{t "files_external" "Enable previews"}}</label>' +
|
' <label for="mountOptionsPreviews">{{t "files_external" "Enable previews"}}</label>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <div class="optionRow">' +
|
' <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>' +
|
' <label for="mountOptionsFilesystemCheck">{{t "files_external" "Check for changes"}}</label>' +
|
||||||
' <select id="mountOptionsFilesystemCheck" name="filesystem_check_changes" data-type="int">' +
|
' <select id="mountOptionsFilesystemCheck" name="filesystem_check_changes" data-type="int">' +
|
||||||
' <option value="0">{{t "files_external" "Never"}}</option>' +
|
' <option value="0">{{t "files_external" "Never"}}</option>' +
|
||||||
|
@ -35,6 +39,7 @@ var MOUNT_OPTIONS_DROPDOWN_TEMPLATE =
|
||||||
templates therefore they are duplicated here
|
templates therefore they are duplicated here
|
||||||
t("files_external", "Enable encryption")
|
t("files_external", "Enable encryption")
|
||||||
t("files_external", "Enable previews")
|
t("files_external", "Enable previews")
|
||||||
|
t("files_external", "Enable sharing")
|
||||||
t("files_external", "Check for changes")
|
t("files_external", "Check for changes")
|
||||||
t("files_external", "Never")
|
t("files_external", "Never")
|
||||||
t("files_external", "Once every direct access")
|
t("files_external", "Once every direct access")
|
||||||
|
@ -830,6 +835,7 @@ MountConfigListView.prototype = _.extend({
|
||||||
$tr.find('input.mountOptions').val(JSON.stringify({
|
$tr.find('input.mountOptions').val(JSON.stringify({
|
||||||
'encrypt': true,
|
'encrypt': true,
|
||||||
'previews': true,
|
'previews': true,
|
||||||
|
'enable_sharing': true,
|
||||||
'filesystem_check_changes': 1
|
'filesystem_check_changes': 1
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1172,7 +1178,7 @@ MountConfigListView.prototype = _.extend({
|
||||||
var storage = this.getStorageConfig($tr);
|
var storage = this.getStorageConfig($tr);
|
||||||
var $toggle = $tr.find('.mountOptionsToggle');
|
var $toggle = $tr.find('.mountOptionsToggle');
|
||||||
var dropDown = new MountOptionsDropdown();
|
var dropDown = new MountOptionsDropdown();
|
||||||
var enabledOptions = ['previews', 'filesystem_check_changes'];
|
var enabledOptions = ['previews', 'filesystem_check_changes', 'enable_sharing'];
|
||||||
if (this._encryptionEnabled) {
|
if (this._encryptionEnabled) {
|
||||||
enabledOptions.push('encrypt');
|
enabledOptions.push('encrypt');
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,16 @@ class OC_Util {
|
||||||
return $storage;
|
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
|
// install storage availability wrapper, before most other wrappers
|
||||||
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
|
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
|
||||||
if (!$storage->isLocal()) {
|
if (!$storage->isLocal()) {
|
||||||
|
|
Loading…
Reference in New Issue