Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check expiry enforcement for all share types #40933

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/files_sharing/src/mixins/SharesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
41 changes: 19 additions & 22 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions dist/4511-4511.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/4511-4511.js.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions dist/9923-9923.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/9923-9923.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

Loading