diff --git a/controllers/authController.go b/controllers/authController.go index 52005b1..9b58dcf 100644 --- a/controllers/authController.go +++ b/controllers/authController.go @@ -132,7 +132,11 @@ func AddUser(c *fiber.Ctx) error { // MARK: GetOwnUser func GetOwnUser(c *fiber.Ctx) error { - user := c.Locals("user").(models.User) + user, ok := c.Locals("user").(models.User) + + if !ok { + return fiber.NewError(fiber.StatusUnauthorized, "Unauthorized: User is not admin") + } return c.JSON(user) }