diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2023-09-11 21:06:23 +0100 |
---|---|---|
committer | fenn-cs <fenn25.fn@gmail.com> | 2023-09-13 10:18:08 +0100 |
commit | 51ad9cfcc8c7ceefbe33b9f3d96cd6ef75ddf9ec (patch) | |
tree | 5777e316ce58b1895cdce9a0f48136744bb48d8c /apps/files_sharing/src | |
parent | cec466ed3bdd35a7143a159eb5f46af013f87cff (diff) | |
download | nextcloud-server-51ad9cfcc8c7ceefbe33b9f3d96cd6ef75ddf9ec.tar.gz nextcloud-server-51ad9cfcc8c7ceefbe33b9f3d96cd6ef75ddf9ec.zip |
Enfore allowPublicShares admin setting
Use the the modern intial-state library to pass data about
`allowPublicUploads` to the sharing frontend.
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r-- | apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue | 2 | ||||
-rw-r--r-- | apps/files_sharing/src/services/ConfigService.js | 9 | ||||
-rw-r--r-- | apps/files_sharing/src/views/SharingDetailsTab.vue | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue b/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue index a83ef503048..b89574a2fca 100644 --- a/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue +++ b/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue @@ -100,7 +100,7 @@ export default { return options }, supportsFileDrop() { - if (this.isFolder) { + if (this.isFolder && this.config.isPublicUploadEnabled) { const shareType = this.share.type ?? this.share.shareType return [this.SHARE_TYPES.SHARE_TYPE_LINK, this.SHARE_TYPES.SHARE_TYPE_EMAIL].includes(shareType) } diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js index e3cd6ad8d46..39062d64846 100644 --- a/apps/files_sharing/src/services/ConfigService.js +++ b/apps/files_sharing/src/services/ConfigService.js @@ -22,8 +22,14 @@ * */ +import { loadState } from '@nextcloud/initial-state' + export default class Config { + constructor() { + this._shareConfig = loadState('files_sharing', 'shareConfig', {}) + } + /** * Is public upload allowed on link shares ? * @@ -32,8 +38,7 @@ export default class Config { * @memberof Config */ get isPublicUploadEnabled() { - return document.getElementsByClassName('files-filestable')[0] - && document.getElementsByClassName('files-filestable')[0].dataset.allowPublicUpload === 'yes' + return this._shareConfig.allowPublicUploads } /** diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index edb0e31e379..89bdd2d528c 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -448,7 +448,7 @@ export default { return this.share.id === null || this.share.id === undefined }, allowsFileDrop() { - if (this.isFolder) { + if (this.isFolder && this.config.isPublicUploadEnabled) { if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) { return true } |