Skip to content

Commit 7bac227

Browse files
Chartman123backportbot[bot]
authored andcommitted
fix: only allow modifying sharing to form owners
fix: only allow modifying sharing to form owners Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de> [skip ci]
1 parent 18a5278 commit 7bac227

3 files changed

Lines changed: 23 additions & 5 deletions

File tree

src/components/SidebarTabs/SharingSearchDiv.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<NcSelectUsers
99
keep-open
1010
:loading="showLoadingCircle"
11-
:disabled="locked"
11+
:disabled="locked || !isCurrentUserOwner"
1212
:options="options"
1313
:placeholder="t('forms', 'Search for user, group or team …')"
1414
:aria-label-listbox="t('forms', 'Search for user, group or team …')"
@@ -46,6 +46,11 @@ export default {
4646
type: Boolean,
4747
required: true,
4848
},
49+
50+
isCurrentUserOwner: {
51+
type: Boolean,
52+
required: true,
53+
},
4954
},
5055
5156
computed: {

src/components/SidebarTabs/SharingShareDiv.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<span>{{ displayName }}</span>
1515
<span>{{ displayNameAppendix }}</span>
1616
</div>
17-
<NcActions class="share-div__actions">
17+
<NcActions class="share-div__actions" :disabled="!isCurrentUserOwner">
1818
<NcActionCaption :name="t('forms', 'Permissions')" />
1919
<NcActionCheckbox
2020
:model-value="canEditForm"
@@ -80,6 +80,11 @@ export default {
8080
type: Boolean,
8181
required: true,
8282
},
83+
84+
isCurrentUserOwner: {
85+
type: Boolean,
86+
required: true,
87+
},
8388
},
8489
8590
computed: {

src/components/SidebarTabs/SharingSidebarTab.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
</div>
3232
<span class="share-div__desc">{{ t('forms', 'Share link') }}</span>
3333
<NcActions>
34-
<NcActionButton :disabled="locked" @click="addPublicLink">
34+
<NcActionButton
35+
:disabled="locked || !isCurrentUserOwner"
36+
@click="addPublicLink">
3537
<template #icon>
3638
<IconPlus :size="20" />
3739
</template>
@@ -80,15 +82,17 @@
8082
</NcActionButton>
8183
<NcActionButton
8284
v-else
83-
:disabled="locked"
85+
:disabled="locked || !isCurrentUserOwner"
8486
@click="makeEmbeddable(share)">
8587
<template #icon>
8688
<IconLinkBoxVariantOutline :size="20" />
8789
</template>
8890
<!-- TRANSLATORS: This means the link can be embedded into external websites -->
8991
{{ t('forms', 'Convert to embeddable link') }}
9092
</NcActionButton>
91-
<NcActionButton :disabled="locked" @click="removeShare(share)">
93+
<NcActionButton
94+
:disabled="locked || !isCurrentUserOwner"
95+
@click="removeShare(share)">
9296
<template #icon>
9397
<IconDelete :size="20" />
9498
</template>
@@ -274,6 +278,10 @@ export default {
274278
},
275279
276280
computed: {
281+
isCurrentUserOwner() {
282+
return getCurrentUser().uid === this.form.ownerId
283+
},
284+
277285
sortedShares() {
278286
// Remove Link-Shares, which are handled separately, then sort
279287
return this.form.shares

0 commit comments

Comments
 (0)