Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-03-25 19:32:49 +0300
committerVincent Petry <vincent@nextcloud.com>2021-04-15 11:06:09 +0300
commitaf61486aea90cfc1a82301ce624dffb59ed01e07 (patch)
tree9b608272439503e0015ece40ae4b77013eabc81f /apps/files_sharing/src
parent2650da70caa73c8bf3119edebb37e91d67f3a214 (diff)
Separate settings for remote share expiration
Added separate settings for default and enforced expiration date for remote shares. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue17
-rw-r--r--apps/files_sharing/src/services/ConfigService.js40
2 files changed, 53 insertions, 4 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 0e6975d9d57..e07654a19c1 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -222,8 +222,12 @@ export default {
},
canHaveNote() {
- return this.share.type !== this.SHARE_TYPES.SHARE_TYPE_REMOTE
- && this.share.type !== this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP
+ return !this.isRemote
+ },
+
+ isRemote() {
+ return this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE
+ || this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP
},
/**
@@ -348,8 +352,13 @@ export default {
},
dateMaxEnforced() {
- return this.config.isDefaultInternalExpireDateEnforced
- && moment().add(1 + this.config.defaultInternalExpireDate, 'days')
+ if (!this.isRemote) {
+ return this.config.isDefaultInternalExpireDateEnforced
+ && moment().add(1 + this.config.defaultInternalExpireDate, 'days')
+ } else {
+ return this.config.isDefaultRemoteExpireDateEnforced
+ && moment().add(1 + this.config.defaultRemoteExpireDate, 'days')
+ }
},
/**
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js
index 84ee5ee0a69..4c8326b1570 100644
--- a/apps/files_sharing/src/services/ConfigService.js
+++ b/apps/files_sharing/src/services/ConfigService.js
@@ -96,6 +96,24 @@ export default class Config {
}
/**
+ * Get the default remote expiration date as string
+ *
+ * @returns {string}
+ * @readonly
+ * @memberof Config
+ */
+ get defaultRemoteExpirationDateString() {
+ let expireDateString = ''
+ if (this.isDefaultRemoteExpireDateEnabled) {
+ const date = window.moment.utc()
+ const expireAfterDays = this.defaultRemoteExpireDate
+ date.add(expireAfterDays, 'days')
+ expireDateString = date.format('YYYY-MM-DD')
+ }
+ return expireDateString
+ }
+
+ /**
* Are link shares password-enforced ?
*
* @returns {boolean}
@@ -151,6 +169,17 @@ export default class Config {
}
/**
+ * Is remote shares expiration enforced ?
+ *
+ * @returns {boolean}
+ * @readonly
+ * @memberof Config
+ */
+ get isDefaultRemoteExpireDateEnforced() {
+ return OC.appConfig.core.defaultRemoteExpireDateEnforced === true
+ }
+
+ /**
* Is there a default expiration date for new internal shares ?
*
* @returns {boolean}
@@ -210,6 +239,17 @@ export default class Config {
}
/**
+ * Get the default days to remote shares expiration
+ *
+ * @returns {int}
+ * @readonly
+ * @memberof Config
+ */
+ get defaultRemoteExpireDate() {
+ return OC.appConfig.core.defaultRemoteExpireDate
+ }
+
+ /**
* Is resharing allowed ?
*
* @returns {boolean}