|
20 | 20 | :current-shares="form.shares" |
21 | 21 | :show-loading="isLoading" |
22 | 22 | :locked="locked" |
| 23 | + :is-current-user-owner="isCurrentUserOwner" |
23 | 24 | @add-share="addShare" /> |
24 | 25 |
|
25 | 26 | <!-- Public Link --> |
|
31 | 32 | </div> |
32 | 33 | <span class="share-div__desc">{{ t('forms', 'Share link') }}</span> |
33 | 34 | <NcActions> |
34 | | - <NcActionButton :disabled="locked" @click="addPublicLink"> |
| 35 | + <NcActionButton |
| 36 | + :disabled="locked || !isCurrentUserOwner" |
| 37 | + @click="addPublicLink"> |
35 | 38 | <template #icon> |
36 | 39 | <IconPlus :size="20" /> |
37 | 40 | </template> |
|
80 | 83 | </NcActionButton> |
81 | 84 | <NcActionButton |
82 | 85 | v-else |
83 | | - :disabled="locked" |
| 86 | + :disabled="locked || !isCurrentUserOwner" |
84 | 87 | @click="makeEmbeddable(share)"> |
85 | 88 | <template #icon> |
86 | 89 | <IconLinkBoxVariantOutline :size="20" /> |
87 | 90 | </template> |
88 | 91 | <!-- TRANSLATORS: This means the link can be embedded into external websites --> |
89 | 92 | {{ t('forms', 'Convert to embeddable link') }} |
90 | 93 | </NcActionButton> |
91 | | - <NcActionButton :disabled="locked" @click="removeShare(share)"> |
| 94 | + <NcActionButton |
| 95 | + :disabled="locked || !isCurrentUserOwner" |
| 96 | + @click="removeShare(share)"> |
92 | 97 | <template #icon> |
93 | 98 | <IconDelete :size="20" /> |
94 | 99 | </template> |
|
97 | 102 | <NcActionButton |
98 | 103 | v-if="appConfig.allowPublicLink" |
99 | 104 | close-after-click |
100 | | - :disabled="locked" |
| 105 | + :disabled="locked || !isCurrentUserOwner" |
101 | 106 | @click="addPublicLink"> |
102 | 107 | <template #icon> |
103 | 108 | <IconPlus :size="20" /> |
|
160 | 165 | <NcCheckboxRadioSwitch |
161 | 166 | id="share-switch__permit-all" |
162 | 167 | :checked="form.access.permitAllUsers" |
163 | | - :disabled="locked" |
| 168 | + :disabled="locked || !isCurrentUserOwner" |
164 | 169 | type="switch" |
165 | 170 | @update:checked="onPermitAllUsersChange" /> |
166 | 171 | </div> |
|
176 | 181 | <NcCheckboxRadioSwitch |
177 | 182 | id="share-switch__show-to-all" |
178 | 183 | :checked="form.access.showToAllUsers" |
179 | | - :disabled="locked" |
| 184 | + :disabled="locked || !isCurrentUserOwner" |
180 | 185 | type="switch" |
181 | 186 | @update:checked="onShowToAllUsersChange" /> |
182 | 187 | </div> |
|
189 | 194 | :key="'share-' + share.shareType + '-' + share.shareWith" |
190 | 195 | :share="share" |
191 | 196 | :locked="locked" |
| 197 | + :is-current-user-owner="isCurrentUserOwner" |
192 | 198 | @remove-share="removeShare" |
193 | 199 | @update:share="updateShare" /> |
194 | 200 | </TransitionGroup> |
195 | 201 | </div> |
196 | 202 | </template> |
197 | 203 |
|
198 | 204 | <script> |
| 205 | +import { getCurrentUser } from '@nextcloud/auth' |
199 | 206 | import { generateOcsUrl } from '@nextcloud/router' |
200 | 207 | import { loadState } from '@nextcloud/initial-state' |
201 | 208 | import { showError } from '@nextcloud/dialogs' |
@@ -274,6 +281,10 @@ export default { |
274 | 281 | }, |
275 | 282 |
|
276 | 283 | computed: { |
| 284 | + isCurrentUserOwner() { |
| 285 | + return getCurrentUser().uid === this.form.ownerId |
| 286 | + }, |
| 287 | +
|
277 | 288 | sortedShares() { |
278 | 289 | // Remove Link-Shares, which are handled separately, then sort |
279 | 290 | return this.form.shares |
|
0 commit comments