新增客户端管理功能,包括创建、编辑和删除客户端的API,更新用户管理功能,添加用户创建和编辑页面,优化管理员功能,增强用户和客户端的管理体验。

This commit is contained in:
2025-04-17 02:29:16 +08:00
parent d06e45e5d4
commit ff47bb2f6f
11 changed files with 823 additions and 77 deletions

16
main.go
View File

@@ -56,6 +56,9 @@ func main() {
"add": func(a, b int) int {
return a + b
},
"multiply": func(a, b int) int {
return a * b
},
})
r.LoadHTMLGlob("templates/*")
@@ -75,7 +78,8 @@ func main() {
oidcHandler := handlers.NewOIDCHandler(config.GlobalConfig.OAuth.IssuerURL, oauthService, authService)
registrationHandler := handlers.NewRegistrationHandler(clientService)
tokenHandler := handlers.NewTokenHandler(tokenService)
adminHandler := handlers.NewAdminHandler(adminService)
adminHandler := handlers.NewAdminHandler(adminService, clientService)
clientHandler := handlers.NewClientHandler(clientService)
// 认证路由
r.GET("/login", authHandler.ShowLogin)
@@ -113,6 +117,16 @@ func main() {
authorized.GET("/dashboard", adminHandler.Dashboard)
authorized.GET("/users", adminHandler.ListUsers)
authorized.GET("/clients", adminHandler.ListClients)
// 用户管理路由
authorized.GET("/users/create", adminHandler.ShowCreateUser)
authorized.POST("/users/create", adminHandler.HandleCreateUser)
authorized.GET("/users/:id/edit", adminHandler.ShowEditUser)
authorized.POST("/users/:id/edit", adminHandler.HandleEditUser)
authorized.POST("/users/:id/delete", adminHandler.HandleDeleteUser)
// 客户端管理API路由
clientHandler.RegisterRoutes(r)
}
}