demo update
This commit is contained in:
@@ -778,16 +778,16 @@ func main() {
|
||||
|
||||
// Route permissions - matching the provided example
|
||||
routePermissions := map[string][]string{
|
||||
"/users": {"exporters"},
|
||||
"/users": {"exporters", "uploaders", "querybuilders"},
|
||||
"/users/:id": {"exporters", "querybuilders"},
|
||||
"/orders": {"exporters", "exporters"},
|
||||
"/reports/sales": {"exporters", "uploaders", "querybuilders"},
|
||||
"/settings": {"exporters"},
|
||||
LOGIN_CALLBACK_PATH: {"exporters", "uploaders", "querybuilders"}, // Only exporters can access
|
||||
"/api/inventory/update": {"exporters", "uploaders"},
|
||||
"/login": {"exporters", "uploaders", "querybuilders"}, // No permissions required for login
|
||||
"/home": {"exporters", "uploaders", "querybuilders"}, // No permissions required for home page
|
||||
"/logout": {"exporters", "uploaders", "querybuilders"}, // No permissions required for logout
|
||||
"/login": {}, // No permissions required for login
|
||||
"/home": {}, // No permissions required for home page
|
||||
"/logout": {}, // No permissions required for logout
|
||||
}
|
||||
|
||||
// Apply JWT auth middleware first
|
||||
@@ -824,30 +824,30 @@ func main() {
|
||||
})
|
||||
})
|
||||
|
||||
// Other endpoint handlers
|
||||
// Other endpoint handlers - just for demonstration
|
||||
e.GET("/users", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Users endpoint")
|
||||
return c.String(http.StatusOK, "Users endpoint (OK)")
|
||||
})
|
||||
|
||||
e.GET("/users/:id", func(c echo.Context) error {
|
||||
id := c.Param("id")
|
||||
return c.String(http.StatusOK, fmt.Sprintf("User details endpoint for ID: %s", id))
|
||||
return c.String(http.StatusOK, fmt.Sprintf("User details endpoint for ID (OK): %s", id))
|
||||
})
|
||||
|
||||
e.GET("/orders", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Orders endpoint")
|
||||
return c.String(http.StatusOK, "Orders endpoint (OK)")
|
||||
})
|
||||
|
||||
e.GET("/reports/sales", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Sales reports endpoint")
|
||||
return c.String(http.StatusOK, "Sales reports endpoint (OK)")
|
||||
})
|
||||
|
||||
e.GET("/settings", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Settings endpoint")
|
||||
return c.String(http.StatusOK, "Settings endpoint (OK)")
|
||||
})
|
||||
|
||||
e.PUT("/api/inventory/update", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Inventory update endpoint")
|
||||
return c.String(http.StatusOK, "Inventory update endpoint (OK)")
|
||||
})
|
||||
|
||||
// Home endpoint for debugging - shows all available endpoints
|
||||
|
||||
Reference in New Issue
Block a user