Skip to content

Commit

Permalink
feat: allow admins to delete accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv9449 committed Feb 3, 2024
1 parent bf8b0fe commit ef3d9bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vitty-backend-api/api/v2/userHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func deleteUser(c *fiber.Ctx) error {
request_user := c.Locals("user").(models.User)

c.Params("username")
if request_user.Username != c.Params("username") {
if request_user.Username != c.Params("username") && request_user.Role != "admin" {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"detail": "You are not authorized to delete this user",
})
Expand Down

0 comments on commit ef3d9bb

Please sign in to comment.