From 6d83a227b052837bee36a08503a042b90e5cf1cb Mon Sep 17 00:00:00 2001
From: Christian Hofmaier
Date: Mon, 20 May 2019 01:56:40 +0000
Subject: [permissionmanager] frontend rework - bulk call for loading childs of
 groups - change submit to save/create - reload site after role changes - skip
 blacklist when no groups selected - performance improvements - new dialog
 system

---
 webapp/src/components/PermissionModuleUserList.vue | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

(limited to 'webapp/src/components/PermissionModuleUserList.vue')

diff --git a/webapp/src/components/PermissionModuleUserList.vue b/webapp/src/components/PermissionModuleUserList.vue
index 609ab37..d25d1e8 100644
--- a/webapp/src/components/PermissionModuleUserList.vue
+++ b/webapp/src/components/PermissionModuleUserList.vue
@@ -31,11 +31,11 @@
         </div>
       </data-table>
     </v-card>
-    <div class="text-xs-right" v-if="canGrant">
-      <v-btn color="error" flat @click="$store.commit('permissions/grantRevoke', { show: true, grant: false } )" :disabled="selectedUsers.length === 0">
+    <div class="text-xs-right">
+      <v-btn color="error" flat @click="revokeRoles" :disabled="selectedUsers.length === 0">
         <v-icon left>remove_circle_outline</v-icon>{{ $t('revoke-role') }}
       </v-btn>
-      <v-btn color="success" flat @click="$store.commit('permissions/grantRevoke', { show: true, grant: true } )" :disabled="selectedUsers.length === 0">
+      <v-btn color="success" flat @click="grantRoles" :disabled="selectedUsers.length === 0">
         <v-icon left>add_circle_outline</v-icon>{{ $t('grant-role') }}
       </v-btn>
     </div>
@@ -43,7 +43,7 @@
 </template>
 
 <script>
-import { mapState } from 'vuex'
+import { mapState, mapMutations } from 'vuex'
 import DataTable from '@/components/DataTable'
 
 export default {
@@ -57,19 +57,21 @@ export default {
         { text: this.$t('username'), key: 'username' },
         { text: this.$t('name'), key: 'name' },
         { text: this.$t('roles'), key: 'roles' }
-      ],
-      canGrant: false
+      ]
     }
   },
   computed: {
-    ...mapState('permissions', ['selectedUsers', 'users'])
+    ...mapState('users', ['users']),
+    ...mapState('permissions', ['selectedUsers'])
   },
   methods: {
-  },
-  created () {
-    this.$http.get('/api/permissions/permissions.grantrevoke').then(response => {
-      this.canGrant = response.data
-    })
+    ...mapMutations('permissions', ['setDialog']),
+    revokeRoles () {
+      this.setDialog({ show: true, type: 'revoke', info: this.selectedUsers })
+    },
+    grantRoles () {
+      this.setDialog({ show: true, type: 'grant', info: this.selectedUsers })
+    }
   }
 }
 </script>
-- 
cgit v1.2.3-55-g7522

