Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/SidebarTabs/SharingSearchDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NcSelectUsers
keepOpen
:loading="showLoadingCircle"
:disabled="locked"
:disabled="locked || !isCurrentUserOwner"
:options="options"
:placeholder="t('forms', 'Search for user, group or team …')"
:aria-label-listbox="t('forms', 'Search for user, group or team …')"
Expand Down Expand Up @@ -47,6 +47,11 @@ export default {
type: Boolean,
required: true,
},

isCurrentUserOwner: {
type: Boolean,
required: true,
},
},

emits: ['addShare'],
Expand Down
7 changes: 6 additions & 1 deletion src/components/SidebarTabs/SharingShareDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<span>{{ displayName }}</span>
<span>{{ displayNameAppendix }}</span>
</div>
<NcActions class="share-div__actions">
<NcActions class="share-div__actions" :disabled="!isCurrentUserOwner">
<NcActionCaption :name="t('forms', 'Permissions')" />
<NcActionCheckbox
:modelValue="canEditForm"
Expand Down Expand Up @@ -79,6 +79,11 @@ export default {
type: Boolean,
required: true,
},

isCurrentUserOwner: {
type: Boolean,
required: true,
},
},

emits: ['removeShare', 'update:share'],
Expand Down
23 changes: 17 additions & 6 deletions src/components/SidebarTabs/SharingSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:currentShares="form.shares"
:showLoading="isLoading"
:locked="locked"
:isCurrentUserOwner="isCurrentUserOwner"
@addShare="addShare" />

<!-- Public Link -->
Expand All @@ -31,7 +32,9 @@
</div>
<span class="share-div__desc">{{ t('forms', 'Share link') }}</span>
<NcActions>
<NcActionButton :disabled="locked" @click="addPublicLink">
<NcActionButton
:disabled="locked || !isCurrentUserOwner"
@click="addPublicLink">
<template #icon>
<IconPlus :size="20" />
</template>
Expand Down Expand Up @@ -80,15 +83,17 @@
</NcActionButton>
<NcActionButton
v-else
:disabled="locked"
:disabled="locked || !isCurrentUserOwner"
@click="makeEmbeddable(share)">
<template #icon>
<IconLinkBoxVariantOutline :size="20" />
</template>
<!-- TRANSLATORS: This means the link can be embedded into external websites -->
{{ t('forms', 'Convert to embeddable link') }}
</NcActionButton>
<NcActionButton :disabled="locked" @click="removeShare(share)">
<NcActionButton
:disabled="locked || !isCurrentUserOwner"
@click="removeShare(share)">
<template #icon>
<IconDelete :size="20" />
</template>
Expand All @@ -97,7 +102,7 @@
<NcActionButton
v-if="appConfig.allowPublicLink"
closeAfterClick
:disabled="locked"
:disabled="locked || !isCurrentUserOwner"
@click="addPublicLink">
<template #icon>
<IconPlus :size="20" />
Expand Down Expand Up @@ -160,7 +165,7 @@
<NcCheckboxRadioSwitch
id="share-switch__permit-all"
:modelValue="form.access.permitAllUsers"
:disabled="locked"
:disabled="locked || !isCurrentUserOwner"
type="switch"
@update:modelValue="onPermitAllUsersChange" />
</div>
Expand All @@ -176,7 +181,7 @@
<NcCheckboxRadioSwitch
id="share-switch__show-to-all"
:modelValue="form.access.showToAllUsers"
:disabled="locked"
:disabled="locked || !isCurrentUserOwner"
type="switch"
@update:modelValue="onShowToAllUsersChange" />
</div>
Expand All @@ -189,13 +194,15 @@
:key="'share-' + share.shareType + '-' + share.shareWith"
:share="share"
:locked="locked"
:isCurrentUserOwner="isCurrentUserOwner"
@removeShare="removeShare"
@update:share="updateShare" />
</TransitionGroup>
</div>
</template>

<script>
import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
Expand Down Expand Up @@ -274,6 +281,10 @@ export default {
},

computed: {
isCurrentUserOwner() {
return getCurrentUser().uid === this.form.ownerId
},

sortedShares() {
// Remove Link-Shares, which are handled separately, then sort
return this.form.shares
Expand Down
Loading