[日志审计]增加删除、清理和别的一些设置

This commit is contained in:
刘祥超
2020-12-02 20:31:42 +08:00
parent 86fef9153a
commit 81681f415d
28 changed files with 485 additions and 78 deletions

View 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()
}