feat(admin): wire up /admin route group with all endpoints

This commit is contained in:
kolaente 2026-04-20 18:58:51 +02:00 committed by kolaente
parent 9ad9a1e987
commit d5f4928034
1 changed files with 25 additions and 0 deletions

View File

@ -59,6 +59,7 @@ import (
"time"
"code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/license"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/modules/auth/oauth2server"
@ -78,6 +79,7 @@ import (
"code.vikunja.io/api/pkg/modules/migration/wekan"
"code.vikunja.io/api/pkg/plugins"
apiv1 "code.vikunja.io/api/pkg/routes/api/v1"
adminapi "code.vikunja.io/api/pkg/routes/api/v1/admin"
"code.vikunja.io/api/pkg/routes/caldav"
"code.vikunja.io/api/pkg/version"
"code.vikunja.io/api/pkg/web/handler"
@ -797,6 +799,29 @@ func registerAPIRoutes(a *echo.Group) {
}
a.POST("/projects/:project/views/:view/buckets/:bucket/tasks", taskBucketProvider.UpdateWeb)
admin := a.Group("/admin",
RequireFeature(license.FeatureAdminPanel),
RequireInstanceAdmin(),
)
adminProjectListHandler := &handler.WebHandler{
EmptyStruct: func() handler.CObject {
return &models.AdminProjectList{}
},
}
adminUserListHandler := &handler.WebHandler{
EmptyStruct: func() handler.CObject {
return &adminapi.UserList{}
},
}
admin.GET("/overview", adminapi.GetOverview)
admin.GET("/users", adminUserListHandler.ReadAllWeb)
admin.POST("/users", adminapi.CreateUser)
admin.PATCH("/users/:id/admin", adminapi.PatchAdmin)
admin.PATCH("/users/:id/status", adminapi.PatchStatus)
admin.DELETE("/users/:id", adminapi.DeleteUser)
admin.GET("/projects", adminProjectListHandler.ReadAllWeb)
admin.PATCH("/projects/:id/owner", adminapi.PatchProjectOwner)
// Plugin routes
if config.PluginsEnabled.GetBool() {
// Authenticated plugin routes