mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix some bugs with userID caused by code restructuring in prev commits
This commit is contained in:
parent
99f71d80c7
commit
7b8fc67512
1 changed files with 4 additions and 4 deletions
|
@ -268,7 +268,7 @@ func updateUser(c *gin.Context) {
|
||||||
|
|
||||||
// Get the user's (to be updated) ID from the context
|
// Get the user's (to be updated) ID from the context
|
||||||
var oldUser User
|
var oldUser User
|
||||||
toBeUpdatedID, err := strconv.Atoi("userID")
|
toBeUpdatedID, err := strconv.Atoi(c.Param("userID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"success": false,
|
"success": false,
|
||||||
|
@ -313,7 +313,7 @@ func updateUser(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if toBeUpdatedID != callerID && callerRole != "Admin" {
|
if uint(toBeUpdatedID) != callerID && callerRole != "Admin" {
|
||||||
c.JSON(http.StatusForbidden, gin.H{
|
c.JSON(http.StatusForbidden, gin.H{
|
||||||
"success": false,
|
"success": false,
|
||||||
"message": "Invalid authorization",
|
"message": "Invalid authorization",
|
||||||
|
@ -394,7 +394,7 @@ func getUser(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := strconv.Atoi("userID")
|
id, err := strconv.Atoi(c.Param("userID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"success": false,
|
"success": false,
|
||||||
|
@ -449,7 +449,7 @@ func deleteUser(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var user User
|
var user User
|
||||||
id, err := strconv.Atoi("userID")
|
id, err := strconv.Atoi(c.Param("userID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"success": false,
|
"success": false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue