Skip to content

Commit 6f4b07b

Browse files
committed
temporary fix
1 parent 6d02191 commit 6f4b07b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/handlers/user.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ func (uh *UserHandlers) UpdateUser(c *gin.Context) {
121121
}
122122

123123
func (uh *UserHandlers) GetUserByUsername(c *gin.Context, username string) {
124-
username, role, err := auth.GetPermissions(c)
124+
_, role, err := auth.GetPermissions(c)
125125
if err != nil {
126126
return
127127
}
128-
if role != "superuser" {
128+
// TODO: temporary fix for admin role, need to verify if user exists when admin
129+
// creating user assigning role to zone, need to add an API for checking user existence
130+
if role != "superuser" && role != "admin" {
129131
c.JSON(http.StatusForbidden, gin.H{"error": "forbidden"})
130132
return
131133
}
@@ -144,7 +146,7 @@ func (uh *UserHandlers) GetUserByUsername(c *gin.Context, username string) {
144146
}
145147

146148
func (uh *UserHandlers) UpdateUserByUsername(c *gin.Context, username string) {
147-
username, role, err := auth.GetPermissions(c)
149+
_, role, err := auth.GetPermissions(c)
148150
if err != nil {
149151
return
150152
}
@@ -180,7 +182,7 @@ func (uh *UserHandlers) UpdateUserByUsername(c *gin.Context, username string) {
180182
}
181183

182184
func (uh *UserHandlers) DeleteUserByUsername(c *gin.Context, username string) {
183-
username, role, err := auth.GetPermissions(c)
185+
_, role, err := auth.GetPermissions(c)
184186
if err != nil {
185187
return
186188
}

0 commit comments

Comments
 (0)