aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/views/SharingTab.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/views/SharingTab.vue')
-rw-r--r--apps/files_sharing/src/views/SharingTab.vue53
1 files changed, 47 insertions, 6 deletions
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue
index e9e068a7c1d..82a11dea2e0 100644
--- a/apps/files_sharing/src/views/SharingTab.vue
+++ b/apps/files_sharing/src/views/SharingTab.vue
@@ -50,7 +50,7 @@
:link-shares="linkShares"
:reshare="reshare"
:shares="shares"
- :placeholder="t('files_sharing', 'Share with accounts and teams')"
+ :placeholder="internalShareInputPlaceholder"
@open-sharing-details="toggleShareDetailsView" />
<!-- other shares list -->
@@ -90,7 +90,7 @@
:file-info="fileInfo"
:link-shares="linkShares"
:is-external="true"
- :placeholder="t('files_sharing', 'Email, federated cloud id')"
+ :placeholder="externalShareInputPlaceholder"
:reshare="reshare"
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />
@@ -100,7 +100,7 @@
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />
<!-- link shares list -->
- <SharingLinkList v-if="!loading"
+ <SharingLinkList v-if="!loading && isLinkSharingAllowed"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
@@ -157,6 +157,7 @@
<script>
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,13 +243,45 @@ 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() {
return !!(this.fileInfo.permissions & OC.PERMISSION_SHARE)
|| !!(this.reshare && this.reshare.hasSharePermission && this.config.isResharingAllowed)
},
+
+ internalShareInputPlaceholder() {
+ return this.config.showFederatedSharesAsInternal
+ ? t('files_sharing', 'Share with accounts, teams, federated cloud IDs')
+ : t('files_sharing', 'Share with accounts and teams')
+ },
+
+ 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')
+ },
},
methods: {
@@ -369,7 +402,11 @@ export default {
if ([ShareType.Link, ShareType.Email].includes(share.type)) {
this.linkShares.push(share)
} else if ([ShareType.Remote, ShareType.RemoteGroup].includes(share.type)) {
- this.externalShares.push(share)
+ if (this.config.showFederatedSharesAsInternal) {
+ this.shares.push(share)
+ } else {
+ this.externalShares.push(share)
+ }
} else {
this.shares.push(share)
}
@@ -439,7 +476,11 @@ export default {
if (share.type === ShareType.Email) {
this.linkShares.unshift(share)
} else if ([ShareType.Remote, ShareType.RemoteGroup].includes(share.type)) {
- this.externalShares.unshift(share)
+ if (this.config.showFederatedSharesAsInternal) {
+ this.shares.unshift(share)
+ } else {
+ this.externalShares.unshift(share)
+ }
} else {
this.shares.unshift(share)
}