mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-20 16:20:27 +08:00
[日志审计]增加删除、清理和别的一些设置
This commit is contained in:
37
internal/web/actions/default/log/delete.go
Normal file
37
internal/web/actions/default/log/delete.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type DeleteAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DeleteAction) RunPost(params struct {
|
||||
LogId int64
|
||||
}) {
|
||||
// 读取配置
|
||||
config, err := configloaders.LoadLogConfig()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if !config.CanDelete {
|
||||
this.Fail("已设置不能删除")
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
defer this.CreateLogInfo("删除单个操作日志 %d", params.LogId)
|
||||
|
||||
// 执行删除
|
||||
_, err = this.RPC().LogRPC().DeleteLogPermanently(this.AdminContext(), &pb.DeleteLogPermanentlyRequest{LogId: params.LogId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user