Skip to content

Commit

Permalink
Merge pull request #30 from Dhruv9449/v2
Browse files Browse the repository at this point in the history
feat: allow admins to delete accounts
  • Loading branch information
Dhruv9449 authored Feb 3, 2024
2 parents bd6e9cc + ef3d9bb commit 79ccd16
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 79ccd16

Please sign in to comment.