diff --git a/src/handlers/delete.go b/src/handlers/delete.go index 6155dd2..8949299 100644 --- a/src/handlers/delete.go +++ b/src/handlers/delete.go @@ -30,7 +30,7 @@ func (h Handlers) AccountDel(c *fiber.Ctx) error { return c.Status(400).JSON([]ResJSONError{{Error: "Invalid uuid format"}}) } - authErr := h.RequireAdminRole(c) + authErr := h.RequireAdminRoleOrAccountID(c, accountID) if authErr != nil { return c.Status(403).JSON([]ResJSONError{{Error: authErr.Error()}}) } diff --git a/src/handlers/get.go b/src/handlers/get.go index 9bf41b0..6763e37 100644 --- a/src/handlers/get.go +++ b/src/handlers/get.go @@ -2,6 +2,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" + "github.com/google/uuid" ) // AccountGet godoc @@ -22,6 +23,11 @@ import ( func (h Handlers) AccountGet(c *fiber.Ctx) error { accountID := c.Params("accountID") + _, uuidErr := uuid.Parse(accountID) + if uuidErr != nil { + return c.Status(400).JSON([]ResJSONError{{Error: "Invalid uuid format"}}) + } + authErr := h.RequireAdminRoleOrAccountID(c, accountID) if authErr != nil { return c.Status(403).JSON([]ResJSONError{{Error: authErr.Error()}})