changeset 4745:aecba7e66301

client: sections:improve showing of delete button depending on user rights
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 18 Oct 2019 13:13:24 +0200
parents 63ead1fab71b
children 5e0041fd3cba
files client/src/components/sections/Sections.vue
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/sections/Sections.vue	Fri Oct 18 13:03:21 2019 +0200
+++ b/client/src/components/sections/Sections.vue	Fri Oct 18 13:13:24 2019 +0200
@@ -48,6 +48,10 @@
                 />
               </button>
               <button
+                v-if="
+                  userCountry === 'global' ||
+                    section.properties.country === userCountry
+                "
                 class="btn btn-xs btn-dark"
                 @click="deleteSection(section)"
               >
@@ -114,6 +118,8 @@
     };
   },
   computed: {
+    ...mapState("user", ["user"]),
+    ...mapGetters("usermanagement", ["userCountries"]),
     ...mapState("application", ["searchQuery"]),
     ...mapGetters("map", ["openLayersMap"]),
     ...mapState("imports", ["sections"]),
@@ -131,6 +137,9 @@
     },
     reviewTooltip() {
       return this.$gettext("Review pending import");
+    },
+    userCountry() {
+      return this.userCountries[this.user];
     }
   },
   methods: {