diff --git a/src/components/teams/EditTeam.vue b/src/components/teams/EditTeam.vue
index d981228d..bf2df9fb 100644
--- a/src/components/teams/EditTeam.vue
+++ b/src/components/teams/EditTeam.vue
@@ -47,21 +47,53 @@
Team Members
-
-
-
- {{m.username}}
-
-
- You
-
-
- Is Admin Normal Member
-
+
+
+
+
+ {{m.username}}
+
+
+ You
+
+
+
+
+
+
+
+ Admin
+
+
+
+
+
+ Member
+
+
+
+
+ Make
+
+ Admin
+
+
+ Member
+
+
+
+
+
+
+
+
+
+
+
This CANNOT BE UNDONE!
+
+
+ Remove a user from the team
+ Are you sure you want to remove this user from the team?
+ He will loose access to all lists and namespaces this team has access to.
+ This CANNOT BE UNDONE!
+
@@ -88,8 +130,10 @@
error: '',
loading: false,
showDeleteModal: false,
+ showUserDeleteModal: false,
user: auth.user,
userIsAdmin: false,
+ userToDelete: 0,
}
},
beforeMount() {
@@ -152,6 +196,33 @@
this.handleError(e)
})
},
+ deleteUser() {
+ HTTP.delete(`teams/` + this.$route.params.id + `/members/` + this.userToDelete, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
+ .then(() => {
+ this.handleSuccess({message: 'The user was successfully deleted from the team.'})
+ this.loadTeam()
+ })
+ .catch(e => {
+ this.handleError(e)
+ })
+ },
+ addUser(userid, admin) {
+ if(admin === null) {
+ admin = false
+ }
+ HTTP.put(`teams/` + this.$route.params.id + `/members`, {admin: admin, user_id: userid}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
+ .then(() => {
+ this.handleSuccess({message: 'The team was successfully added.'})
+ })
+ .catch(e => {
+ this.handleError(e)
+ })
+ },
+ toggleUserType(userid, current) {
+ this.userToDelete = userid
+ this.deleteUser()
+ this.addUser(userid, !current)
+ },
handleError(e) {
this.loading = false
message.error(e, this)
@@ -164,12 +235,34 @@
}
-
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 75616bf6..161fb192 100644
--- a/src/main.js
+++ b/src/main.js
@@ -26,6 +26,8 @@ import { faAngleRight } from '@fortawesome/free-solid-svg-icons'
import { faLayerGroup } from '@fortawesome/free-solid-svg-icons'
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons'
import { faUsers } from '@fortawesome/free-solid-svg-icons'
+import { faUser } from '@fortawesome/free-solid-svg-icons'
+import { faLock } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
library.add(faSignOutAlt)
@@ -37,6 +39,8 @@ library.add(faAngleRight)
library.add(faLayerGroup)
library.add(faTrashAlt)
library.add(faUsers)
+library.add(faUser)
+library.add(faLock)
Vue.component('icon', FontAwesomeIcon)