Skip to content

Commit

Permalink
restored previous authentication flow
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye committed Feb 9, 2024
1 parent 1767217 commit 64e09da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions backend/src/server/routes/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 64e09da

Please sign in to comment.