Skip to content

Commit

Permalink
enabling "invite people" for password-protected folder/file (#9931)
Browse files Browse the repository at this point in the history
* enabling invite people for password-protected folder/files

* removed hasPassword from LinkShareRoles

* added invite people for password-protected folder changelog
  • Loading branch information
jacob-nv committed Nov 16, 2023
1 parent af4db19 commit 6314825
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,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(
Expand Down Expand Up @@ -630,7 +637,6 @@ export default defineComponent({
this.hasPublicLinkEditing,
this.hasPublicLinkContribute,
this.hasPublicLinkAliasSupport,
!!link.password,
this.canCreatePublicLinks
)
}
Expand All @@ -640,7 +646,6 @@ export default defineComponent({
this.hasPublicLinkEditing,
this.hasPublicLinkContribute,
this.hasPublicLinkAliasSupport,
!!link.password,
this.canCreatePublicLinks
)
}
Expand Down
8 changes: 2 additions & 6 deletions packages/web-client/src/helpers/share/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] : []),
Expand All @@ -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)
}

/**
Expand All @@ -402,7 +401,6 @@ export abstract class LinkShareRoles {
* @param canEditFile
* @param canContribute
* @param hasAliasLinks
* @param hasPassword
* @param canCreatePublicLinks
*/
static filterByBitmask(
Expand All @@ -411,15 +409,13 @@ export abstract class LinkShareRoles {
canEditFile = false,
canContribute = false,
hasAliasLinks = false,
hasPassword = false,
canCreatePublicLinks = true
): ShareRole[] {
return this.list(
isFolder,
canEditFile,
canContribute,
hasAliasLinks,
hasPassword,
canCreatePublicLinks
).filter((r) => {
return bitmask === (bitmask | r.bitmask(false))
Expand Down
2 changes: 1 addition & 1 deletion packages/web-client/tests/unit/helpers/share/role.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 6314825

Please sign in to comment.