aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2023-09-11 21:06:23 +0100
committerfenn-cs <fenn25.fn@gmail.com>2023-09-12 20:50:49 +0100
commit766806c35d6abf4816a2bd57d386dc43520e3f6f (patch)
tree0c621e3e03e77bc5b46dab811c69907c4841dcb5 /apps/files_sharing/src
parentef996400955db8c631a2a3d995b356edfe0ca4bc (diff)
downloadnextcloud-server-766806c35d6abf4816a2bd57d386dc43520e3f6f.tar.gz
nextcloud-server-766806c35d6abf4816a2bd57d386dc43520e3f6f.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.vue2
-rw-r--r--apps/files_sharing/src/services/ConfigService.js9
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue2
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 d77688df2d7..6246bdb65e3 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -453,7 +453,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
}