From a0b9e1381ebd66ede8406fadf2a9c1adcc4fca1e Mon Sep 17 00:00:00 2001 From: nfebe Date: Fri, 13 Jun 2025 12:07:22 +0100 Subject: [PATCH] feat(files_sharing): Hide external shares for users in excluded groups - Added frontend check to hide link shares if, public sharing is disabled. Signed-off-by: nfebe [skip ci] --- apps/files_sharing/src/views/SharingTab.vue | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 85c1aaa764f..7ceec34ab2f 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -100,7 +100,7 @@ :file-info="fileInfo" @open-sharing-details="toggleShareDetailsView" /> - import { getCurrentUser } from '@nextcloud/auth' +import { getCapabilities } from '@nextcloud/capabilities' import { orderBy } from '@nextcloud/files' import { loadState } from '@nextcloud/initial-state' import { generateOcsUrl } from '@nextcloud/router' @@ -242,7 +243,24 @@ export default { * @return {boolean} */ isSharedWithMe() { - return Object.keys(this.sharedWithMe).length > 0 + return this.sharedWithMe !== null + && this.sharedWithMe !== undefined + }, + + /** + * Is link sharing allowed for the current user? + * + * @return {boolean} + */ + isLinkSharingAllowed() { + const currentUser = getCurrentUser() + if (!currentUser) { + return false + } + + const capabilities = getCapabilities() + const publicSharing = capabilities.files_sharing?.public || {} + return publicSharing.enabled === true }, canReshare() { @@ -257,6 +275,9 @@ export default { }, externalShareInputPlaceholder() { + if (!this.isLinkSharingAllowed) { + return t('files_sharing', 'Federated cloud ID') + } return this.config.showFederatedSharesAsInternal ? t('files_sharing', 'Email') : t('files_sharing', 'Email, federated cloud id')