Skip to content

Commit

Permalink
🛂 Remove edit from context menu, if no permissions (gchq#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Feb 12, 2022
1 parent 0b07abe commit 0146e99
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/components/LinkItems/ItemContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</li>
</ul>
<!-- Edit Options -->
<ul class="menu-section">
<ul class="menu-section" v-bind:class="{ disabled: !isEditAllowed }">
<li class="section-title">
{{ $t('context-menus.item.options-section-title') }}
</li>
Expand Down Expand Up @@ -85,6 +85,9 @@ export default {
isEditMode() {
return this.$store.state.editMode;
},
isEditAllowed() {
return this.$store.getters.permissions.allowViewConfig;
},
},
methods: {
/* Called on item click, emits an event up to Item */
Expand All @@ -93,13 +96,19 @@ export default {
this.$emit('launchItem', target);
},
openSettings() {
this.$emit('openItemSettings');
if (this.isEditAllowed) {
this.$emit('openItemSettings');
}
},
openMoveMenu() {
this.$emit('openMoveItemMenu');
if (this.isEditAllowed) {
this.$emit('openMoveItemMenu');
}
},
openDeleteItem() {
this.$emit('openDeleteItem');
if (this.isEditAllowed) {
this.$emit('openDeleteItem');
}
},
},
};
Expand Down Expand Up @@ -149,6 +158,13 @@ div.context-menu {
path { fill: currentColor; }
}
}
&.disabled li:not(.section-title) {
cursor: not-allowed;
opacity: var(--dimming-factor);
&:hover {
background: var(--context-menu-background);
}
}
}
}
Expand Down

0 comments on commit 0146e99

Please sign in to comment.