Skip to content

Commit 0146e99

Browse files
committed
🛂 Remove edit from context menu, if no permissions (gchq#455)
1 parent 0b07abe commit 0146e99

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/components/LinkItems/ItemContextMenu.vue

+20-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</li>
3030
</ul>
3131
<!-- Edit Options -->
32-
<ul class="menu-section">
32+
<ul class="menu-section" v-bind:class="{ disabled: !isEditAllowed }">
3333
<li class="section-title">
3434
{{ $t('context-menus.item.options-section-title') }}
3535
</li>
@@ -85,6 +85,9 @@ export default {
8585
isEditMode() {
8686
return this.$store.state.editMode;
8787
},
88+
isEditAllowed() {
89+
return this.$store.getters.permissions.allowViewConfig;
90+
},
8891
},
8992
methods: {
9093
/* Called on item click, emits an event up to Item */
@@ -93,13 +96,19 @@ export default {
9396
this.$emit('launchItem', target);
9497
},
9598
openSettings() {
96-
this.$emit('openItemSettings');
99+
if (this.isEditAllowed) {
100+
this.$emit('openItemSettings');
101+
}
97102
},
98103
openMoveMenu() {
99-
this.$emit('openMoveItemMenu');
104+
if (this.isEditAllowed) {
105+
this.$emit('openMoveItemMenu');
106+
}
100107
},
101108
openDeleteItem() {
102-
this.$emit('openDeleteItem');
109+
if (this.isEditAllowed) {
110+
this.$emit('openDeleteItem');
111+
}
103112
},
104113
},
105114
};
@@ -149,6 +158,13 @@ div.context-menu {
149158
path { fill: currentColor; }
150159
}
151160
}
161+
&.disabled li:not(.section-title) {
162+
cursor: not-allowed;
163+
opacity: var(--dimming-factor);
164+
&:hover {
165+
background: var(--context-menu-background);
166+
}
167+
}
152168
}
153169
}
154170

0 commit comments

Comments
 (0)