feat: 添加操作日志拦截中间件
This commit is contained in:
@@ -14,20 +14,15 @@ func (s *BackupRouter) InitBackupRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("backups").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
baRouter.GET("/search", baseApi.ListBackup)
|
||||
baRouter.POST("/buckets", baseApi.ListBuckets)
|
||||
withRecordRouter.POST("", baseApi.CreateBackup)
|
||||
withRecordRouter.POST("/del", baseApi.DeleteBackup)
|
||||
withRecordRouter.POST("/record/search", baseApi.SearchBackupRecords)
|
||||
withRecordRouter.POST("/record/download", baseApi.DownloadRecord)
|
||||
withRecordRouter.POST("/record/del", baseApi.DeleteBackupRecord)
|
||||
withRecordRouter.PUT(":id", baseApi.UpdateBackup)
|
||||
baRouter.POST("", baseApi.CreateBackup)
|
||||
baRouter.POST("/del", baseApi.DeleteBackup)
|
||||
baRouter.POST("/update", baseApi.UpdateBackup)
|
||||
baRouter.POST("/record/search", baseApi.SearchBackupRecords)
|
||||
baRouter.POST("/record/download", baseApi.DownloadRecord)
|
||||
baRouter.POST("/record/del", baseApi.DeleteBackupRecord)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,17 +14,12 @@ func (s *CommandRouter) InitCommandRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("commands").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
withRecordRouter.POST("", baseApi.CreateCommand)
|
||||
withRecordRouter.POST("/del", baseApi.DeleteCommand)
|
||||
withRecordRouter.PUT(":id", baseApi.UpdateCommand)
|
||||
cmdRouter.POST("/search", baseApi.SearchCommand)
|
||||
cmdRouter.GET("", baseApi.ListCommand)
|
||||
cmdRouter.POST("", baseApi.CreateCommand)
|
||||
cmdRouter.POST("/del", baseApi.DeleteCommand)
|
||||
cmdRouter.POST("/search", baseApi.SearchCommand)
|
||||
cmdRouter.POST("/update", baseApi.UpdateCommand)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,41 +13,36 @@ func (s *ContainerRouter) InitContainerRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("containers").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
baRouter.GET("/exec", baseApi.ContainerExec)
|
||||
baRouter.GET("/stats/:id", baseApi.ContainerStats)
|
||||
|
||||
baRouter.POST("/search", baseApi.SearchContainer)
|
||||
baRouter.POST("/inspect", baseApi.Inspect)
|
||||
baRouter.POST("", baseApi.ContainerCreate)
|
||||
baRouter.POST("/log", baseApi.ContainerLogs)
|
||||
withRecordRouter.POST("operate", baseApi.ContainerOperation)
|
||||
baRouter.POST("/search", baseApi.SearchContainer)
|
||||
baRouter.POST("/search/log", baseApi.ContainerLogs)
|
||||
baRouter.POST("/inspect", baseApi.Inspect)
|
||||
baRouter.POST("/operate", baseApi.ContainerOperation)
|
||||
|
||||
baRouter.POST("/repo/search", baseApi.SearchRepo)
|
||||
baRouter.PUT("/repo/:id", baseApi.UpdateRepo)
|
||||
baRouter.GET("/repo", baseApi.ListRepo)
|
||||
withRecordRouter.POST("/repo", baseApi.CreateRepo)
|
||||
withRecordRouter.POST("/repo/del", baseApi.DeleteRepo)
|
||||
baRouter.POST("/repo/search", baseApi.SearchRepo)
|
||||
baRouter.POST("/repo/update", baseApi.UpdateRepo)
|
||||
baRouter.POST("/repo", baseApi.CreateRepo)
|
||||
baRouter.POST("/repo/del", baseApi.DeleteRepo)
|
||||
|
||||
baRouter.POST("/compose/search", baseApi.SearchCompose)
|
||||
baRouter.POST("/compose", baseApi.CreateCompose)
|
||||
baRouter.POST("/compose/operate", baseApi.OperatorCompose)
|
||||
baRouter.POST("/compose/update", baseApi.ComposeUpdate)
|
||||
|
||||
baRouter.POST("/template/search", baseApi.SearchComposeTemplate)
|
||||
baRouter.PUT("/template/:id", baseApi.UpdateComposeTemplate)
|
||||
baRouter.GET("/template", baseApi.ListComposeTemplate)
|
||||
withRecordRouter.POST("/template", baseApi.CreateComposeTemplate)
|
||||
withRecordRouter.POST("/template/del", baseApi.DeleteComposeTemplate)
|
||||
baRouter.POST("/template/search", baseApi.SearchComposeTemplate)
|
||||
baRouter.POST("/template/update", baseApi.UpdateComposeTemplate)
|
||||
baRouter.POST("/template", baseApi.CreateComposeTemplate)
|
||||
baRouter.POST("/template/del", baseApi.DeleteComposeTemplate)
|
||||
|
||||
baRouter.POST("/image/search", baseApi.SearchImage)
|
||||
baRouter.GET("/image", baseApi.ListImage)
|
||||
baRouter.POST("/image/search", baseApi.SearchImage)
|
||||
baRouter.POST("/image/pull", baseApi.ImagePull)
|
||||
baRouter.POST("/image/push", baseApi.ImagePush)
|
||||
baRouter.POST("/image/save", baseApi.ImageSave)
|
||||
@@ -56,12 +51,12 @@ func (s *ContainerRouter) InitContainerRouter(Router *gin.RouterGroup) {
|
||||
baRouter.POST("/image/tag", baseApi.ImageTag)
|
||||
baRouter.POST("/image/build", baseApi.ImageBuild)
|
||||
|
||||
baRouter.GET("/volume", baseApi.ListVolume)
|
||||
baRouter.POST("/network/del", baseApi.DeleteNetwork)
|
||||
baRouter.POST("/network/search", baseApi.SearchNetwork)
|
||||
baRouter.POST("/network", baseApi.CreateNetwork)
|
||||
baRouter.POST("/volume/del", baseApi.DeleteVolume)
|
||||
baRouter.POST("/volume/search", baseApi.SearchVolume)
|
||||
baRouter.GET("/volume", baseApi.ListVolume)
|
||||
baRouter.POST("/volume", baseApi.CreateVolume)
|
||||
|
||||
baRouter.GET("/daemonjson", baseApi.LoadDaemonJson)
|
||||
|
||||
@@ -14,18 +14,13 @@ func (s *CronjobRouter) InitCronjobRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("cronjobs").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
withRecordRouter.POST("", baseApi.CreateCronjob)
|
||||
withRecordRouter.POST("/del", baseApi.DeleteCronjob)
|
||||
withRecordRouter.PUT(":id", baseApi.UpdateCronjob)
|
||||
withRecordRouter.POST("/status", baseApi.UpdateCronjobStatus)
|
||||
cmdRouter.POST("/handle/:id", baseApi.HandleOnce)
|
||||
cmdRouter.POST("", baseApi.CreateCronjob)
|
||||
cmdRouter.POST("/del", baseApi.DeleteCronjob)
|
||||
cmdRouter.POST("/update", baseApi.UpdateCronjob)
|
||||
cmdRouter.POST("/status", baseApi.UpdateCronjobStatus)
|
||||
cmdRouter.POST("/handle", baseApi.HandleOnce)
|
||||
cmdRouter.POST("/download", baseApi.TargetDownload)
|
||||
cmdRouter.POST("/search", baseApi.SearchCronjob)
|
||||
cmdRouter.POST("/search/records", baseApi.SearchJobRecords)
|
||||
|
||||
@@ -14,23 +14,18 @@ func (s *DatabaseRouter) InitDatabaseRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("databases").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
withRecordRouter.POST("", baseApi.CreateMysql)
|
||||
withRecordRouter.POST("/change/access", baseApi.ChangeMysqlAccess)
|
||||
withRecordRouter.POST("/change/password", baseApi.ChangeMysqlPassword)
|
||||
withRecordRouter.POST("/backup", baseApi.BackupMysql)
|
||||
withRecordRouter.POST("/recover/byupload", baseApi.RecoverMysqlByUpload)
|
||||
withRecordRouter.POST("/recover", baseApi.RecoverMysql)
|
||||
withRecordRouter.POST("/del/check/:id", baseApi.DeleteCheckMysql)
|
||||
withRecordRouter.POST("/del/:id", baseApi.DeleteMysql)
|
||||
withRecordRouter.POST("/variables/update", baseApi.UpdateMysqlVariables)
|
||||
withRecordRouter.POST("/conf/update/byfile", baseApi.UpdateMysqlConfByFile)
|
||||
cmdRouter.POST("", baseApi.CreateMysql)
|
||||
cmdRouter.POST("/change/access", baseApi.ChangeMysqlAccess)
|
||||
cmdRouter.POST("/change/password", baseApi.ChangeMysqlPassword)
|
||||
cmdRouter.POST("/backup", baseApi.BackupMysql)
|
||||
cmdRouter.POST("/recover/byupload", baseApi.RecoverMysqlByUpload)
|
||||
cmdRouter.POST("/recover", baseApi.RecoverMysql)
|
||||
cmdRouter.POST("/del/check", baseApi.DeleteCheckMysql)
|
||||
cmdRouter.POST("/del", baseApi.DeleteMysql)
|
||||
cmdRouter.POST("/variables/update", baseApi.UpdateMysqlVariables)
|
||||
cmdRouter.POST("/conffile/update", baseApi.UpdateMysqlConfByFile)
|
||||
cmdRouter.POST("/search", baseApi.SearchMysql)
|
||||
cmdRouter.GET("/variables", baseApi.LoadVariables)
|
||||
cmdRouter.GET("/status", baseApi.LoadStatus)
|
||||
@@ -45,9 +40,9 @@ func (s *DatabaseRouter) InitDatabaseRouter(Router *gin.RouterGroup) {
|
||||
cmdRouter.POST("/redis/password", baseApi.ChangeRedisPassword)
|
||||
cmdRouter.POST("/redis/backup", baseApi.RedisBackup)
|
||||
cmdRouter.POST("/redis/recover", baseApi.RedisRecover)
|
||||
cmdRouter.POST("/redis/backup/records", baseApi.RedisBackupList)
|
||||
cmdRouter.POST("/redis/backuplist/search", baseApi.RedisBackupList)
|
||||
cmdRouter.POST("/redis/conf/update", baseApi.UpdateRedisConf)
|
||||
cmdRouter.POST("/redis/conf/update/byfile", baseApi.UpdateRedisConfByFile)
|
||||
cmdRouter.POST("/redis/conf/update/persistence", baseApi.UpdateRedisPersistenceConf)
|
||||
cmdRouter.POST("/redis/conffile/update", baseApi.UpdateRedisConfByFile)
|
||||
cmdRouter.POST("/redis/persistence/update", baseApi.UpdateRedisPersistenceConf)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,11 @@ func (s *GroupRouter) InitGroupRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("groups").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
withRecordRouter.POST("", baseApi.CreateGroup)
|
||||
withRecordRouter.DELETE(":id", baseApi.DeleteGroup)
|
||||
withRecordRouter.PUT(":id", baseApi.UpdateGroup)
|
||||
groupRouter.POST("", baseApi.CreateGroup)
|
||||
groupRouter.POST("/del", baseApi.DeleteGroup)
|
||||
groupRouter.POST("/update", baseApi.UpdateGroup)
|
||||
groupRouter.POST("/search", baseApi.ListGroup)
|
||||
groupRouter.GET(":id", baseApi.GetGroupInfo)
|
||||
}
|
||||
|
||||
@@ -14,16 +14,11 @@ func (s *HostRouter) InitHostRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("hosts").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
withRecordRouter.POST("", baseApi.CreateHost)
|
||||
withRecordRouter.DELETE(":id", baseApi.DeleteHost)
|
||||
withRecordRouter.PUT(":id", baseApi.UpdateHost)
|
||||
hostRouter.POST("", baseApi.CreateHost)
|
||||
hostRouter.POST("/del", baseApi.DeleteHost)
|
||||
hostRouter.POST("/update", baseApi.UpdateHost)
|
||||
hostRouter.POST("/search", baseApi.HostTree)
|
||||
hostRouter.POST("/testconn", baseApi.TestConn)
|
||||
hostRouter.GET(":id", baseApi.GetHostInfo)
|
||||
|
||||
@@ -14,17 +14,12 @@ func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) {
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired())
|
||||
withRecordRouter := Router.Group("settings").
|
||||
Use(middleware.JwtAuth()).
|
||||
Use(middleware.SessionAuth()).
|
||||
Use(middleware.PasswordExpired()).
|
||||
Use(middleware.OperationRecord())
|
||||
baseApi := v1.ApiGroupApp.BaseApi
|
||||
{
|
||||
baseRouter.POST("/search", baseApi.GetSettingInfo)
|
||||
baseRouter.PUT("/expired/handle", baseApi.HandlePasswordExpired)
|
||||
withRecordRouter.PUT("", baseApi.UpdateSetting)
|
||||
settingRouter.PUT("/password", baseApi.UpdatePassword)
|
||||
baseRouter.POST("/expired/handle", baseApi.HandlePasswordExpired)
|
||||
baseRouter.POST("/update", baseApi.UpdateSetting)
|
||||
settingRouter.POST("/password/update", baseApi.UpdatePassword)
|
||||
settingRouter.POST("/time/sync", baseApi.SyncTime)
|
||||
settingRouter.POST("/monitor/clean", baseApi.CleanMonitor)
|
||||
settingRouter.GET("/mfa", baseApi.GetMFA)
|
||||
|
||||
Reference in New Issue
Block a user