diff --git a/backend/src/server/routes/user.go b/backend/src/server/routes/user.go index 1b1cdde9b..2926e875c 100644 --- a/backend/src/server/routes/user.go +++ b/backend/src/server/routes/user.go @@ -4,6 +4,7 @@ import ( "github.com/GenerateNU/sac/backend/src/controllers" "github.com/GenerateNU/sac/backend/src/middleware" "github.com/GenerateNU/sac/backend/src/services" + "github.com/GenerateNU/sac/backend/src/types" "github.com/gofiber/fiber/v2" ) @@ -13,11 +14,11 @@ func User(router fiber.Router, userService services.UserServiceInterface, middle // api/v1/users/* users := router.Group("/users") users.Post("/", userController.CreateUser) - users.Get("/", userController.GetUsers) + users.Get("/", middleware.SuperSkipper(middlewareService.Authorize(types.UserReadAll)), userController.GetUsers) // api/v1/users/:userID/* usersID := users.Group("/:userID") - usersID.Use(middlewareService.UserAuthorizeById) + usersID.Use(middleware.SuperSkipper(middlewareService.UserAuthorizeById)) usersID.Get("/", userController.GetUser) usersID.Patch("/", userController.UpdateUser) diff --git a/backend/src/server/server.go b/backend/src/server/server.go index 7de1ea3bf..5d249a0a3 100644 --- a/backend/src/server/server.go +++ b/backend/src/server/server.go @@ -34,7 +34,7 @@ func Init(db *gorm.DB, settings config.Settings) *fiber.App { middlewareService := middleware.NewMiddlewareService(db, validate, settings.Auth) apiv1 := app.Group("/api/v1") - // apiv1.Use(middlewareService.Authenticate) + apiv1.Use(middlewareService.Authenticate) routes.Utility(app)