mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #40928 from nextcloud/backport/stable27/40927
[stable27] Allow share expiry dates lower than enforced limits
This commit is contained in:
commit
1452773ed9
8 changed files with 35 additions and 37 deletions
|
|
@ -140,9 +140,9 @@ export default {
|
|||
return this.config.isDefaultExpireDateEnforced
|
||||
}
|
||||
if (this.isRemoteShare) {
|
||||
return this.config.isDefaultRemoteExpireDateEnforced || this.config.isDefaultExpireDateEnforced
|
||||
return this.config.isDefaultRemoteExpireDateEnforced
|
||||
}
|
||||
return this.config.isDefaultInternalExpireDateEnforced || this.config.isDefaultExpireDateEnforced
|
||||
return this.config.isDefaultInternalExpireDateEnforced
|
||||
},
|
||||
hasCustomPermissions() {
|
||||
const bundledPermissions = [
|
||||
|
|
|
|||
|
|
@ -113,11 +113,10 @@
|
|||
</NcCheckboxRadioSwitch>
|
||||
<NcDateTimePickerNative v-if="hasExpirationDate"
|
||||
id="share-date-picker"
|
||||
:value="new Date(share.expireDate)"
|
||||
:value="new Date(share.expireDate ?? dateTomorrow)"
|
||||
:min="dateTomorrow"
|
||||
:max="dateMaxEnforced"
|
||||
:max="maxExpirationDateEnforced"
|
||||
:hide-label="true"
|
||||
:disabled="isExpiryDateEnforced"
|
||||
:placeholder="t('files_sharing', 'Expiration date')"
|
||||
type="date"
|
||||
@input="onExpirationChange" />
|
||||
|
|
@ -135,9 +134,6 @@
|
|||
<NcCheckboxRadioSwitch v-if="!isPublicShare" :disabled="!canSetDownload" :checked.sync="canDownload">
|
||||
{{ t('files_sharing', 'Allow download') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
<NcCheckboxRadioSwitch v-if="!isPublicShare" :disabled="!canSetDownload" :checked.sync="canDownload">
|
||||
{{ t('file_sharing', 'Allow download') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
<NcCheckboxRadioSwitch :checked.sync="writeNoteToRecipientIsChecked">
|
||||
{{ t('files_sharing', 'Note to recipient') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
|
|
@ -374,19 +370,7 @@ export default {
|
|||
*/
|
||||
hasExpirationDate: {
|
||||
get() {
|
||||
const isDefaultExpireDateEnabled = this.config.isDefaultExpireDateEnabled
|
||||
const hasExistingExpirationDate = !!this.share.expireDate || isDefaultExpireDateEnabled
|
||||
const isDefaultInternalExpireDateEnabled = this.config.isDefaultInternalExpireDateEnabled
|
||||
const isDefaultRemoteExpireDateEnabled = this.config.isDefaultRemoteExpireDateEnabled
|
||||
if (this.isPublicShare) {
|
||||
return hasExistingExpirationDate
|
||||
}
|
||||
|
||||
if (this.isRemoteShare) {
|
||||
return hasExistingExpirationDate || isDefaultRemoteExpireDateEnabled
|
||||
}
|
||||
|
||||
return hasExistingExpirationDate || isDefaultInternalExpireDateEnabled
|
||||
return this.isValidShareAttribute(this.share.expireDate)
|
||||
},
|
||||
set(enabled) {
|
||||
this.share.expireDate = enabled
|
||||
|
|
@ -418,11 +402,16 @@ export default {
|
|||
isFolder() {
|
||||
return this.fileInfo.type === 'dir'
|
||||
},
|
||||
dateMaxEnforced() {
|
||||
if (!this.isRemoteShare && this.config.isDefaultInternalExpireDateEnforced) {
|
||||
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultInternalExpireDate))
|
||||
} else if (this.config.isDefaultRemoteExpireDateEnforced) {
|
||||
return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultRemoteExpireDate))
|
||||
maxExpirationDateEnforced() {
|
||||
if (this.isExpiryDateEnforced) {
|
||||
if (this.isPublicShare) {
|
||||
return this.config.defaultExpirationDate
|
||||
}
|
||||
if (this.isRemoteShare) {
|
||||
return this.config.defaultRemoteExpirationDateString
|
||||
}
|
||||
// If it get's here then it must be an internal share
|
||||
return this.config.defaultInternalExpirationDate
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
|
@ -699,10 +688,19 @@ export default {
|
|||
this.share.newPassword = await GeneratePassword()
|
||||
this.advancedSectionAccordionExpanded = true
|
||||
}
|
||||
if (this.hasExpirationDate) {
|
||||
this.share.expireDate = this.defaultExpiryDate
|
||||
/* Set default expiration dates if configured */
|
||||
if (this.isPublicShare && this.config.isDefaultExpireDateEnabled) {
|
||||
this.share.expireDate = this.config.defaultExpirationDate.toDateString()
|
||||
} else if (this.isRemoteShare && this.config.isDefaultRemoteExpireDateEnabled) {
|
||||
this.share.expireDate = this.config.defaultRemoteExpirationDateString.toDateString()
|
||||
} else if (this.config.isDefaultInternalExpireDateEnabled) {
|
||||
this.share.expireDate = this.config.defaultInternalExpirationDate.toDateString()
|
||||
}
|
||||
|
||||
if (this.isValidShareAttribute(this.share.expireDate)) {
|
||||
this.advancedSectionAccordionExpanded = true
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
4
dist/core-common.js
vendored
4
dist/core-common.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-common.js.map
vendored
2
dist/core-common.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_sharing-files_sharing_tab.js
vendored
4
dist/files_sharing-files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-files_sharing_tab.js.map
vendored
2
dist/files_sharing-files_sharing_tab.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue