Browse Source

Enable project delete button only for project administrators

pull/945/head
Hironsan 4 years ago
parent
commit
53894e4d9a
2 changed files with 5 additions and 4 deletions
  1. 4
      frontend/components/containers/projects/ProjectDeletionButton.vue
  2. 5
      frontend/store/projects.js

4
frontend/components/containers/projects/ProjectDeletionButton.vue

@ -1,6 +1,6 @@
<template>
<confirm-dialog
:disabled="!isProjectSelected"
:disabled="!isDeletable"
:items="selected"
title="Delete Project"
message="Are you sure you want to delete these projects?"
@ -20,7 +20,7 @@ export default {
computed: {
...mapState('projects', ['selected']),
...mapGetters('projects', ['isProjectSelected'])
...mapGetters('projects', ['isDeletable'])
},
methods: {

5
frontend/store/projects.js

@ -8,8 +8,9 @@ export const state = () => ({
})
export const getters = {
isProjectSelected(state) {
return state.selected.length > 0
isDeletable(state) {
const isProjectAdministrator = project => project.current_users_role.is_project_admin
return state.selected.length > 0 && state.selected.every(isProjectAdministrator)
},
currentProject(state) {
return state.current

Loading…
Cancel
Save