Changing user roles, Deleting users
This commit is contained in:
parent
e38d8e3a88
commit
3053b1c89a
7 changed files with 132 additions and 12 deletions
86
motorradig/public/js/app.js
vendored
86
motorradig/public/js/app.js
vendored
|
|
@ -2128,6 +2128,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
data: function data() {
|
||||
return {
|
||||
|
|
@ -2196,6 +2198,39 @@ __webpack_require__.r(__webpack_exports__);
|
|||
console.log("Loading of Userlist failed.");
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
setRole: function setRole(user_id, role) {
|
||||
var _this4 = this;
|
||||
|
||||
console.log("Setting new role for userid " + user_id + ": " + role); // Empty brackets are an empty object usually containing form data
|
||||
|
||||
axios.post('http://localhost:8000/api/v1/auth/set_role', {
|
||||
user_id: user_id,
|
||||
role: role
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.$store.state.user_token
|
||||
}
|
||||
}).then(function (res) {
|
||||
//this.$router.go();//Reload page with updated access-based display
|
||||
_this4.$router.push('/');
|
||||
});
|
||||
},
|
||||
deleteUser: function deleteUser(user_id) {
|
||||
var _this5 = this;
|
||||
|
||||
console.log("Deleting userid " + user_id); // Empty brackets are an empty object usually containing form data
|
||||
|
||||
axios.post('http://localhost:8000/api/v1/auth/delete_user', {
|
||||
user_id: user_id
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.$store.state.user_token
|
||||
}
|
||||
}).then(function (res) {
|
||||
//this.$router.go();//Reload page with updated access-based display
|
||||
_this5.$router.push('/');
|
||||
});
|
||||
}
|
||||
},
|
||||
created: function created() {
|
||||
|
|
@ -31555,11 +31590,56 @@ var render = function() {
|
|||
_vm._s(user.role) +
|
||||
")\n "
|
||||
),
|
||||
_c("button", [_vm._v("Gast")]),
|
||||
_c(
|
||||
"button",
|
||||
{
|
||||
on: {
|
||||
click: function($event) {
|
||||
return _vm.setRole(user.id, "GUEST")
|
||||
}
|
||||
}
|
||||
},
|
||||
[_vm._v("Gast")]
|
||||
),
|
||||
_vm._v(" "),
|
||||
_c("button", [_vm._v("Mitglied")]),
|
||||
_c(
|
||||
"button",
|
||||
{
|
||||
on: {
|
||||
click: function($event) {
|
||||
return _vm.setRole(user.id, "MEMBER")
|
||||
}
|
||||
}
|
||||
},
|
||||
[_vm._v("Mitglied")]
|
||||
),
|
||||
_vm._v(" "),
|
||||
_c("button", [_vm._v("Administrator")])
|
||||
_c(
|
||||
"button",
|
||||
{
|
||||
on: {
|
||||
click: function($event) {
|
||||
return _vm.setRole(user.id, "ADMIN")
|
||||
}
|
||||
}
|
||||
},
|
||||
[_vm._v("Administrator")]
|
||||
),
|
||||
_vm._v(" "),
|
||||
_c("span", [_vm._v(" ")]),
|
||||
_vm._v(" "),
|
||||
_c(
|
||||
"button",
|
||||
{
|
||||
staticStyle: { color: "red" },
|
||||
on: {
|
||||
click: function($event) {
|
||||
return _vm.deleteUser(user.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
[_vm._v("LÖSCHEN")]
|
||||
)
|
||||
])
|
||||
}),
|
||||
0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue