diff --git a/pkg/models/api_routes.go b/pkg/models/api_routes.go index 7afe2f969..211c81251 100644 --- a/pkg/models/api_routes.go +++ b/pkg/models/api_routes.go @@ -69,7 +69,7 @@ func getRouteGroupName(path string) string { // CollectRoutesForAPITokenUsage gets called for every added APITokenRoute and builds a list of all routes we can use for the api tokens. func CollectRoutesForAPITokenUsage(route echo.Route) { - if !strings.Contains(route.Name, "(*WebHandler)") { + if !strings.Contains(route.Name, "(*WebHandler)") && !strings.Contains(route.Name, "Attachment") { return } @@ -116,6 +116,21 @@ func CollectRoutesForAPITokenUsage(route echo.Route) { Method: route.Method, } } + + if routeGroupName == "tasks_attachments" { + if strings.Contains(route.Name, "UploadTaskAttachment") { + apiTokenRoutes[routeGroupName].Create = &RouteDetail{ + Path: route.Path, + Method: route.Method, + } + } + if strings.Contains(route.Name, "GetTaskAttachment") { + apiTokenRoutes[routeGroupName].ReadOne = &RouteDetail{ + Path: route.Path, + Method: route.Method, + } + } + } } // GetAvailableAPIRoutesForToken returns a list of all API routes which are available for token usage.