add check roles
This commit is contained in:
9
main.go
9
main.go
@@ -4,6 +4,7 @@ import (
|
||||
"astra-users/config"
|
||||
"astra-users/handler"
|
||||
"astra-users/model"
|
||||
"astra-users/mw"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"gorm.io/driver/sqlite"
|
||||
@@ -49,11 +50,11 @@ func main() {
|
||||
e.DELETE("/:id", h.DeleteUser)
|
||||
e.GET("/health", h.Health)
|
||||
|
||||
e.GET("/positions/:id", h.GetPositionHandler)
|
||||
e.POST("/positions", h.CreatePosition)
|
||||
e.GET("/positions/:id", h.GetPositionHandler, mw.CheckAdminRole)
|
||||
e.POST("/positions", h.CreatePosition, mw.CheckAdminRole)
|
||||
|
||||
e.GET("/organizations", h.GetOrganizations)
|
||||
e.POST("/organizations", h.CreateOrganization)
|
||||
e.GET("/organizations", h.GetOrganizations, mw.CheckAdminRole)
|
||||
e.POST("/organizations", h.CreateOrganization, mw.CheckAdminRole)
|
||||
|
||||
e.Logger.Fatal(e.Start(":" + config.Env.Server.Port))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user