Merge pull request #40933 from nextcloud/check-datemax-enforcement-pubshare

Check expiry enforcement for all share types
pull/41053/head
Côme Chilliet 2023-10-23 09:32:27 +07:00 committed by GitHub
commit 61143644a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 31 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 = [

@ -385,19 +385,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
@ -430,14 +418,14 @@ export default {
return this.fileInfo.type === 'dir'
},
maxExpirationDateEnforced() {
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
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
@ -715,10 +703,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
}

3
dist/4511-4511.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
dist/9923-9923.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long