changeset 2277:5f3110aa1ad1

made configuration page accessible for waterway admins User roles define what the configuration page shows.
author Markus Kottlaender <markus@intevation.de>
date Fri, 15 Feb 2019 10:57:50 +0100
parents 920fba6eef0d
children e9112939581e
files client/src/components/Sidebar.vue client/src/components/systemconfiguration/Systemconfiguration.vue client/src/router.js
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue	Fri Feb 15 10:44:45 2019 +0100
+++ b/client/src/components/Sidebar.vue	Fri Feb 15 10:57:50 2019 +0100
@@ -110,6 +110,8 @@
           ></font-awesome-icon>
           <span class="fix-trans-space" v-translate>Users</span>
         </router-link>
+      </div>
+      <div v-if="isWaterwayAdmin">
         <router-link to="systemconfiguration">
           <font-awesome-icon
             class="fa-fw mr-2"
@@ -118,6 +120,8 @@
           ></font-awesome-icon>
           <span class="fix-trans-space" v-translate>Configuration</span>
         </router-link>
+      </div>
+      <div v-if="isSysAdmin">
         <router-link to="logs">
           <font-awesome-icon
             class="fa-fw mr-2"
--- a/client/src/components/systemconfiguration/Systemconfiguration.vue	Fri Feb 15 10:44:45 2019 +0100
+++ b/client/src/components/systemconfiguration/Systemconfiguration.vue	Fri Feb 15 10:57:50 2019 +0100
@@ -10,7 +10,7 @@
       </h6>
       <div class="card-body text-left">
         <PDFTemplates />
-        <ColorSettings />
+        <ColorSettings v-if="isSysAdmin" />
       </div>
       <!-- card-body -->
     </div>
@@ -41,12 +41,17 @@
  * Bernhard Reiter <bernhard@intevation.de>
  * Markus Kottländer <markus@intevation.de>
  */
+import { mapGetters } from "vuex";
+
 export default {
   name: "systemconfiguration",
   components: {
     Spacer: () => import("../Spacer"),
     PDFTemplates: () => import("./PDFTemplates"),
     ColorSettings: () => import("./ColorSettings")
+  },
+  computed: {
+    ...mapGetters("user", ["isSysAdmin"])
   }
 };
 </script>
--- a/client/src/router.js	Fri Feb 15 10:44:45 2019 +0100
+++ b/client/src/router.js	Fri Feb 15 10:57:50 2019 +0100
@@ -71,8 +71,8 @@
         requiresAuth: true
       },
       beforeEnter: (to, from, next) => {
-        const isSysadmin = store.getters["user/isSysAdmin"];
-        if (!isSysadmin) {
+        const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
+        if (!isWaterwayAdmin) {
           next("/");
         } else {
           next();