summaryrefslogtreecommitdiffstats
path: root/apps/files_external/js
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-12-06 11:18:59 +0100
committerVincent Petry <vincent@nextcloud.com>2021-12-15 09:15:31 +0100
commitea302975526ba8fcb5abcca76daa6038439d053e (patch)
treef00714de6e983897719b98cb3c56ed5476156823 /apps/files_external/js
parenta47da9722dfaec8d83e9c8543ed0c31138a909da (diff)
downloadnextcloud-server-ea302975526ba8fcb5abcca76daa6038439d053e.tar.gz
nextcloud-server-ea302975526ba8fcb5abcca76daa6038439d053e.zip
Add option to disallow creation of local storages
Introduce a new config option to prevent web UI admins to create or edit external storages of type "local". Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_external/js')
-rw-r--r--apps/files_external/js/settings.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index bed380bab14..266b4f96af3 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -659,6 +659,7 @@ MountConfigListView.prototype = _.extend({
}
this._encryptionEnabled = options.encryptionEnabled;
+ this._canCreateLocal = options.canCreateLocal;
// read the backend config that was carefully crammed
// into the data-configurations attribute of the select
@@ -825,10 +826,13 @@ MountConfigListView.prototype = _.extend({
$tr.addClass(backend.identifier);
$tr.find('.backend').data('identifier', backend.identifier);
- if (backend.invalid) {
+ if (backend.invalid || (backend.identifier === 'local' && !this._canCreateLocal)) {
$tr.find('[name=mountPoint]').prop('disabled', true);
$tr.find('.applicable,.mountOptionsToggle').empty();
- this.updateStatus($tr, false, 'Unknown backend: ' + backend.name);
+ $tr.find('.save').empty();
+ if (backend.invalid) {
+ this.updateStatus($tr, false, 'Unknown backend: ' + backend.name);
+ }
return $tr;
}
@@ -981,6 +985,7 @@ MountConfigListView.prototype = _.extend({
var storageConfig = new self._storageConfigClass();
_.extend(storageConfig, storageParams);
var $tr = self.newStorage(storageConfig, onCompletion);
+
self.recheckStorageConfig($tr);
});
onCompletion.resolve();
@@ -1325,9 +1330,11 @@ MountConfigListView.prototype = _.extend({
window.addEventListener('DOMContentLoaded', function() {
var enabled = $('#files_external').attr('data-encryption-enabled');
+ var canCreateLocal = $('#files_external').attr('data-can-create-local');
var encryptionEnabled = (enabled ==='true')? true: false;
var mountConfigListView = new MountConfigListView($('#externalStorage'), {
- encryptionEnabled: encryptionEnabled
+ encryptionEnabled: encryptionEnabled,
+ canCreateLocal: (canCreateLocal === 'true') ? true: false,
});
mountConfigListView.loadStorages();