Skip to content

Commit

Permalink
Allow resharing only when enabled via capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Jun 30, 2022
1 parent 6665a56 commit 4ee8b26
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ export default {
return SpacePeopleShareRoles.list()
}
console.log(this.share)
if (this.resource.isReceivedShare() && this.resourceIsSharable && this.share) {
return PeopleShareRoles.filterByBitmask(
parseInt(this.share.permissions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import { showQuickLinkPasswordModal } from '../../../quickActions'
import DetailsAndEdit from './Links/DetailsAndEdit.vue'
import NameAndCopy from './Links/NameAndCopy.vue'
import CreateQuickLink from './Links/CreateQuickLink.vue'
import { isLocationSpacesActive } from '../../../router'
export default defineComponent({
name: 'FileLinks',
Expand Down Expand Up @@ -244,6 +245,14 @@ export default defineComponent({
},
canCreatePublicLinks() {
const reSharingEnabled = this.capabilities?.files_sharing?.resharing === true
if (this.highlightedFile.isReceivedShare() && !reSharingEnabled) {
return false
}
const isShareJail = isLocationSpacesActive(this.$router, 'files-spaces-share')
if (isShareJail && !reSharingEnabled) {
return false
}
return this.highlightedFile.canShare({ user: this.user })
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default {
}
},
computed: {
...mapGetters(['capabilities']),
...mapGetters('Files', ['highlightedFile', 'currentFileOutgoingCollaborators']),
...mapState('Files', ['incomingShares', 'sharesTree']),
...mapState(['user']),
Expand Down Expand Up @@ -261,6 +262,15 @@ export default {
},
currentUserCanShare() {
const reSharingEnabled = this.capabilities?.files_sharing?.resharing === true
if (this.highlightedFile.isReceivedShare() && !reSharingEnabled) {
return false
}
const isShareJail = isLocationSpacesActive(this.$router, 'files-spaces-share')
if (isShareJail && !reSharingEnabled) {
return false
}
return this.highlightedFile.canShare({ user: this.user })
},
noResharePermsMessage() {
Expand Down

0 comments on commit 4ee8b26

Please sign in to comment.