Skip to content

Commit

Permalink
🐛 Fix list namespace auth (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Feb 21, 2024
1 parent c738843 commit 4753a98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pkg/handlers/builders/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ func (f factory) Initialize(e *echo.Echo) error {
builderGroup.GET("/:builder_id/runners/:runner_id", handler.GetRunner)
builderGroup.GET("/:builder_id/runners/:runner_id/stop", handler.GetRunnerStop)
builderGroup.GET("/:builder_id/runners/:runner_id/rerun", handler.GetRunnerRerun)

builderWithoutAuthGroup := e.Group(consts.APIV1 + "/namespaces/:namespace_id/repositories/:repository_id/builders")
builderWithoutAuthGroup.GET("/:builder_id/runners/:runner_id/log", handler.GetRunnerLog)
builderGroup.GET("/:builder_id/runners/:runner_id/log", handler.GetRunnerLog)
}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/handlers/namespaces/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,11 @@ type factory struct{}

// Initialize initializes the namespace handlers
func (f factory) Initialize(e *echo.Echo) error {
namespaceGroupWithoutAuth := e.Group(consts.APIV1 + "/namespaces")
namespaceGroup := e.Group(consts.APIV1+"/namespaces", middlewares.AuthWithConfig(middlewares.AuthConfig{}))

namespaceHandler := handlerNew()

namespaceGroupWithoutAuth.GET("/", namespaceHandler.ListNamespaces)
namespaceGroup.GET("/", namespaceHandler.ListNamespaces)
namespaceGroup.GET("/:id", namespaceHandler.GetNamespace)
namespaceGroup.POST("/", namespaceHandler.PostNamespace)
namespaceGroup.PUT("/:id", namespaceHandler.PutNamespace)
Expand Down
1 change: 1 addition & 0 deletions pkg/handlers/namespaces/namespaces_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (h *handler) ListNamespaces(c echo.Context) error {
return xerrors.NewHTTPError(c, xerrors.HTTPErrCodeUnauthorized)
}
}
fmt.Println(63, iuser, user)

var req types.ListNamespaceRequest
err := utils.BindValidate(c, &req)
Expand Down

0 comments on commit 4753a98

Please sign in to comment.