partial working

This commit is contained in:
jay brown
2025-04-11 16:46:05 -07:00
parent ba6f624299
commit 61accd4dd4
7 changed files with 100 additions and 88 deletions
+17 -1
View File
@@ -9,6 +9,8 @@ import (
"strconv"
"time"
"queryorchestration/internal/cognitoauth"
"queryorchestration/internal/server"
"github.com/getkin/kin-openapi/openapi3"
@@ -170,6 +172,21 @@ func New(ctx context.Context, cfg Config) (*Server, error) {
}
e := echo.New()
cfg.SetRouter(e)
// auth start - may move to separate rbac function
routePermissions := map[string][]string{
"/users": {"exporters", "uploaders", "querybuilders"},
"/users/:id": {"exporters", "querybuilders"},
"/orders": {"exporters"},
"/reports/sales": {"exporters", "uploaders", "querybuilders"},
"/settings": {"exporters"},
"/api/inventory/update": {"exporters", "uploaders"},
}
cfg.SetAuthRoutePermissions(routePermissions)
cognitoauth.RegisterRoutes(cfg.GetRouter(), cfg)
// auth end
e.Use(echoprometheus.NewMiddleware("echo"))
e.GET("/metrics", echoprometheus.NewHandler())
@@ -181,7 +198,6 @@ func New(ctx context.Context, cfg Config) (*Server, error) {
// Add debug middleware early to catch all requests
e.Use(getDebugMiddleware(cfg.GetLogger()))
cfg.SetRouter(e)
opnapi, err := cfg.RegisterHandlers()
if err != nil {
return nil, err