From 0f99d66e9ad6891ecf066ef6d151aa7a47a34437 Mon Sep 17 00:00:00 2001 From: Jacob Noah Date: Fri, 10 Nov 2023 16:44:43 +0100 Subject: [PATCH 1/3] enabling invite people for password-protected folder/files --- .../src/components/SideBar/Shares/FileLinks.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index 2832009aa51..f93d2fa5340 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -443,7 +443,14 @@ export default defineComponent({ }, checkLinkToUpdate({ link }) { - const params = this.getParamsForLink(link) + let params = this.getParamsForLink(link) + if (link.permissions === 0) { + params = { + ...params, + password: '', + expireDate: '' + } + } if (!link.password && !this.canDeletePublicLinkPassword(link)) { showQuickLinkPasswordModal( @@ -629,7 +636,7 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - !!link.password, + false, this.canCreatePublicLinks ) } @@ -639,7 +646,7 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - !!link.password, + false, this.canCreatePublicLinks ) } From c41dde308ff9a58c83265c42112ee567fe27b531 Mon Sep 17 00:00:00 2001 From: Jacob Noah Date: Wed, 15 Nov 2023 12:05:24 +0100 Subject: [PATCH 2/3] removed hasPassword from LinkShareRoles --- .../src/components/SideBar/Shares/FileLinks.vue | 2 -- packages/web-client/src/helpers/share/role.ts | 8 ++------ packages/web-client/tests/unit/helpers/share/role.spec.ts | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index f93d2fa5340..e73624b97b9 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -636,7 +636,6 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - false, this.canCreatePublicLinks ) } @@ -646,7 +645,6 @@ export default defineComponent({ this.hasPublicLinkEditing, this.hasPublicLinkContribute, this.hasPublicLinkAliasSupport, - false, this.canCreatePublicLinks ) } diff --git a/packages/web-client/src/helpers/share/role.ts b/packages/web-client/src/helpers/share/role.ts index 08e51ec3eb0..2d398304351 100644 --- a/packages/web-client/src/helpers/share/role.ts +++ b/packages/web-client/src/helpers/share/role.ts @@ -377,11 +377,10 @@ export abstract class LinkShareRoles { canEditFile = false, canContribute = false, hasAliasLinks = false, - hasPassword = false, canCreatePublicLinks = true ): ShareRole[] { return [ - ...(hasAliasLinks && !hasPassword ? [linkRoleInternalFile, linkRoleInternalFolder] : []), + ...(hasAliasLinks ? [linkRoleInternalFile, linkRoleInternalFolder] : []), ...(canCreatePublicLinks ? [linkRoleViewerFile] : []), ...(canCreatePublicLinks ? [linkRoleViewerFolder] : []), ...(canCreatePublicLinks && canContribute ? [linkRoleContributorFolder] : []), @@ -392,7 +391,7 @@ export abstract class LinkShareRoles { } static getByBitmask(bitmask: number, isFolder: boolean): ShareRole { - return this.list(isFolder, true, true, true, false).find((r) => r.bitmask(false) === bitmask) + return this.list(isFolder, true, true, true, true).find((r) => r.bitmask(false) === bitmask) } /** @@ -402,7 +401,6 @@ export abstract class LinkShareRoles { * @param canEditFile * @param canContribute * @param hasAliasLinks - * @param hasPassword * @param canCreatePublicLinks */ static filterByBitmask( @@ -411,7 +409,6 @@ export abstract class LinkShareRoles { canEditFile = false, canContribute = false, hasAliasLinks = false, - hasPassword = false, canCreatePublicLinks = true ): ShareRole[] { return this.list( @@ -419,7 +416,6 @@ export abstract class LinkShareRoles { canEditFile, canContribute, hasAliasLinks, - hasPassword, canCreatePublicLinks ).filter((r) => { return bitmask === (bitmask | r.bitmask(false)) diff --git a/packages/web-client/tests/unit/helpers/share/role.spec.ts b/packages/web-client/tests/unit/helpers/share/role.spec.ts index 883a154f652..9ebdb56383d 100644 --- a/packages/web-client/tests/unit/helpers/share/role.spec.ts +++ b/packages/web-client/tests/unit/helpers/share/role.spec.ts @@ -239,7 +239,7 @@ describe('roles', () => { } ] ])('%s', (name: string, { folder, result }) => { - expect(LinkShareRoles.list(folder, true, true, true, false)).toEqual(result) + expect(LinkShareRoles.list(folder, true, true, true, true)).toEqual(result) }) }) describe('getByBitmask', () => { From 1a1052d36fbe4425ed5a938dc044ee295f5057a1 Mon Sep 17 00:00:00 2001 From: Jacob Noah Date: Wed, 15 Nov 2023 14:53:27 +0100 Subject: [PATCH 3/3] added invite people for password-protected folder changelog --- .../bugfix-invite people-password-protected-folder | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/unreleased/bugfix-invite people-password-protected-folder diff --git a/changelog/unreleased/bugfix-invite people-password-protected-folder b/changelog/unreleased/bugfix-invite people-password-protected-folder new file mode 100644 index 00000000000..6383d8b2322 --- /dev/null +++ b/changelog/unreleased/bugfix-invite people-password-protected-folder @@ -0,0 +1,7 @@ +Bugfix: Enabling "invite people" for password-protected folder/file + +Enables selecting "invite people" for password-protected folder/file. +Selecting this permission will drop password protection and expiration date. + +https://github.com/owncloud/web/pull/9931 +https://github.com/owncloud/web/issues/9922