diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue index 7f136d3a3e9..c71cdd1f7a5 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue @@ -86,6 +86,7 @@ import { useCapabilityFilesSharingAllowCustomPermissions, useCapabilityFilesSharingCanDenyAccess, useCapabilityFilesSharingResharing, + useCapabilityFilesSharingResharingDefault, useCapabilityShareJailEnabled, useStore } from 'web-pkg/src/composables' @@ -123,6 +124,7 @@ export default defineComponent({ const store = useStore() return { hasResharing: useCapabilityFilesSharingResharing(store), + resharingDefault: useCapabilityFilesSharingResharingDefault(store), hasShareJail: useCapabilityShareJailEnabled(store), hasRoleCustomPermissions: useCapabilityFilesSharingAllowCustomPermissions(store), hasRoleDenyAccess: useCapabilityFilesSharingCanDenyAccess(store), @@ -305,7 +307,9 @@ export default defineComponent({ const bitmask = this.selectedRole.hasCustomPermissions ? SharePermissions.permissionsToBitmask(this.customPermissions) : SharePermissions.permissionsToBitmask( - this.selectedRole.permissions(this.hasResharing || this.resourceIsSpace) + this.selectedRole.permissions( + (this.hasResharing && this.resharingDefault) || this.resourceIsSpace + ) ) let path = this.highlightedFile.path diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue index 8dab60129a4..76fb82505bf 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue @@ -108,7 +108,10 @@ import { DateTime } from 'luxon' import EditDropdown from './EditDropdown.vue' import RoleDropdown from './RoleDropdown.vue' import { SharePermissions, ShareTypes } from 'web-client/src/helpers/share' -import { useCapabilityFilesSharingResharing } from 'web-pkg/src/composables' +import { + useCapabilityFilesSharingResharing, + useCapabilityFilesSharingResharingDefault +} from 'web-pkg/src/composables' import { extractDomSelector } from 'web-client/src/helpers/resource' import { defineComponent } from '@vue/composition-api' import * as uuid from 'uuid' @@ -138,6 +141,7 @@ export default defineComponent({ setup() { return { hasResharing: useCapabilityFilesSharingResharing(), + resharingDefault: useCapabilityFilesSharingResharingDefault(), ...useGraphClient() } }, @@ -361,7 +365,9 @@ export default defineComponent({ saveShareChanges({ role, permissions, expirationDate }) { const bitmask = role.hasCustomPermissions ? SharePermissions.permissionsToBitmask(permissions) - : SharePermissions.permissionsToBitmask(role.permissions(this.hasResharing || this.isSpace)) + : SharePermissions.permissionsToBitmask( + role.permissions((this.hasResharing && this.resharingDefault) || this.isSpace) + ) const changeMethod = this.isSpace ? this.changeSpaceMember : this.changeShare changeMethod({ client: this.$client, diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue index e913b31c9a6..e82f0e2aba5 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/RoleDropdown.vue @@ -42,7 +42,10 @@ > - + @@ -118,6 +121,7 @@ import { PropType } from '@vue/composition-api' import { useCapabilityFilesSharingAllowCustomPermissions, useCapabilityFilesSharingCanDenyAccess, + useCapabilityFilesSharingResharingDefault, useStore } from 'web-pkg/src/composables' @@ -154,7 +158,8 @@ export default defineComponent({ const store = useStore() return { hasRoleDenyAccess: useCapabilityFilesSharingCanDenyAccess(store), - hasRoleCustomPermissions: useCapabilityFilesSharingAllowCustomPermissions(store) + hasRoleCustomPermissions: useCapabilityFilesSharingAllowCustomPermissions(store), + resharingDefault: useCapabilityFilesSharingResharingDefault(store) } }, data() { @@ -253,7 +258,9 @@ export default defineComponent({ if (this.selectedRole.hasCustomPermissions) { this.customPermissions = this.existingPermissions } else { - this.customPermissions = [...this.selectedRole.permissions(this.allowSharePermission)] + this.customPermissions = [ + ...this.selectedRole.permissions(this.allowSharePermission && this.resharingDefault) + ] } }, @@ -270,7 +277,7 @@ export default defineComponent({ return } this.selectedRole = role - this.customPermissions = role.permissions(this.allowSharePermission) + this.customPermissions = role.permissions(this.allowSharePermission && this.resharingDefault) this.publishChange() }, @@ -288,7 +295,7 @@ export default defineComponent({ this.selectedRole = PeopleShareRoles.getByBitmask( bitmask, this.resource.isFolder, - this.allowSharePermission + this.allowSharePermission && this.resharingDefault ) this.publishChange() }, diff --git a/packages/web-app-files/src/store/actions.ts b/packages/web-app-files/src/store/actions.ts index 816f78f232b..bc2dfbceacf 100644 --- a/packages/web-app-files/src/store/actions.ts +++ b/packages/web-app-files/src/store/actions.ts @@ -17,7 +17,10 @@ import { WebDAV } from 'web-client/src/webdav' import { ClientService } from 'web-pkg/src/services' const allowSharePermissions = (getters) => { - return get(getters, `capabilities.files_sharing.resharing`, true) + return ( + get(getters, `capabilities.files_sharing.resharing`, true) && + get(getters, `capabilities.files_sharing.resharing_default`, true) + ) } export default { diff --git a/packages/web-pkg/src/composables/capability/useCapability.ts b/packages/web-pkg/src/composables/capability/useCapability.ts index 50b6f9ea492..3b21e4cbc48 100644 --- a/packages/web-pkg/src/composables/capability/useCapability.ts +++ b/packages/web-pkg/src/composables/capability/useCapability.ts @@ -33,6 +33,10 @@ export const useCapabilityFilesSharingResharing = createCapabilityComposable( 'files_sharing.resharing', true ) +export const useCapabilityFilesSharingResharingDefault = createCapabilityComposable( + 'files_sharing.resharing_default', + true +) export const useCapabilitySpacesEnabled = createCapabilityComposable('spaces.enabled', false) export const useCapabilityProjectSpacesEnabled = createCapabilityComposable(