mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-15 12:46:34 +08:00
改进操作日志
This commit is contained in:
@@ -90,7 +90,7 @@ func (this *CleanAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "清除缓存,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "清除缓存,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "创建缓存策略:%d", createResp.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "创建缓存策略:%d", createResp.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ func (this *PreheatAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "预热缓存,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "预热缓存,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func (this *PurgeAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除缓存,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除缓存,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (this *StatAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "统计缓存,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "统计缓存,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (this *TestReadAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "测试读取,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "测试读取,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (this *TestWriteAction) RunPost(params struct {
|
||||
this.Data["results"] = results
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "测试写入,缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "测试写入,缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改缓存策略:%d", params.CachePolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改缓存策略:%d", params.CachePolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "创建代理服务分组 %d", createResp.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "创建代理服务分组 %d", createResp.GroupId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
GroupId int64
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除代理服务分组 %d", params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除代理服务分组 %d", params.GroupId)
|
||||
|
||||
// 检查是否正在使用
|
||||
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithGroupId(this.AdminContext(), &pb.CountAllEnabledServersWithGroupIdRequest{GroupId: params.GroupId})
|
||||
|
||||
@@ -14,7 +14,7 @@ func (this *SortAction) RunPost(params struct {
|
||||
GroupIds []int64
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改代理分组排序")
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改代理分组排序")
|
||||
|
||||
_, err := this.RPC().ServerGroupRPC().UpdateServerGroupOrders(this.AdminContext(), &pb.UpdateServerGroupOrdersRequest{GroupIds: params.GroupIds})
|
||||
if err != nil {
|
||||
|
||||
@@ -45,7 +45,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改代理服务分组 %d", params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改代理服务分组 %d", params.GroupId)
|
||||
|
||||
params.Must.
|
||||
Field("name", params.Name).
|
||||
|
||||
@@ -56,7 +56,7 @@ func (this *IndexAction) RunPost(params struct {
|
||||
DefaultDomain string
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "保存代理服务全局配置")
|
||||
defer this.CreateLog(oplogs.LevelInfo, "保存代理服务全局配置")
|
||||
|
||||
if len(params.GlobalConfigJSON) == 0 {
|
||||
this.Fail("错误的配置信息,请刷新当前页面后重试")
|
||||
|
||||
@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
LibraryId int64
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除IP库 %d", params.LibraryId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除IP库 %d", params.LibraryId)
|
||||
|
||||
_, err := this.RPC().IPLibraryRPC().DeleteIPLibrary(this.AdminContext(), &pb.DeleteIPLibraryRequest{IpLibraryId: params.LibraryId})
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ func (this *DownloadAction) RunGet(params struct {
|
||||
LibraryId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "下载IP库 %d", params.LibraryId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "下载IP库 %d", params.LibraryId)
|
||||
|
||||
libraryResp, err := this.RPC().IPLibraryRPC().FindEnabledIPLibrary(this.AdminContext(), &pb.FindEnabledIPLibraryRequest{IpLibraryId: params.LibraryId})
|
||||
if err != nil {
|
||||
|
||||
@@ -104,7 +104,7 @@ func (this *UploadPopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "上传IP库 %d", createResp.IpLibraryId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "上传IP库 %d", createResp.IpLibraryId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
CertId int64
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除SSL证书 %d", params.CertId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除SSL证书 %d", params.CertId)
|
||||
|
||||
// 是否正在被使用
|
||||
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithSSLCertId(this.AdminContext(), &pb.CountAllEnabledServersWithSSLCertIdRequest{CertId: params.CertId})
|
||||
|
||||
@@ -19,6 +19,8 @@ func (this *DownloadCertAction) Init() {
|
||||
func (this *DownloadCertAction) RunGet(params struct {
|
||||
CertId int64
|
||||
}) {
|
||||
defer this.CreateLogInfo("下载SSL证书 %d", params.CertId)
|
||||
|
||||
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -19,6 +19,8 @@ func (this *DownloadKeyAction) Init() {
|
||||
func (this *DownloadKeyAction) RunGet(params struct {
|
||||
CertId int64
|
||||
}) {
|
||||
defer this.CreateLogInfo("下载SSL密钥 %d", params.CertId)
|
||||
|
||||
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -20,6 +20,8 @@ func (this *DownloadZipAction) Init() {
|
||||
func (this *DownloadZipAction) RunGet(params struct {
|
||||
CertId int64
|
||||
}) {
|
||||
defer this.CreateLogInfo("下载SSL证书压缩包 %d", params.CertId)
|
||||
|
||||
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -56,7 +56,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改SSL证书 %d", params.CertId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改SSL证书 %d", params.CertId)
|
||||
|
||||
// 查询Cert
|
||||
certConfigResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
|
||||
|
||||
@@ -115,7 +115,7 @@ func (this *UploadPopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
this.CreateLog(oplogs.LevelInfo, "上传SSL证书 %d", certId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "上传SSL证书 %d", certId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func (this *CreateGroupPopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "创建规则分组 %d,名称:%s", groupId, params.Name)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "创建规则分组 %d,名称:%s", groupId, params.Name)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "创建WAF策略 %d", createResp.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "创建WAF策略 %d", createResp.FirewallPolicyId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
FirewallPolicyId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d", params.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d", params.FirewallPolicyId)
|
||||
|
||||
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithHTTPFirewallPolicyId(this.AdminContext(), &pb.CountAllEnabledServersWithHTTPFirewallPolicyIdRequest{FirewallPolicyId: params.FirewallPolicyId})
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func (this *DeleteGroupAction) RunPost(params struct {
|
||||
GroupId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d 的规则分组 %d", params.FirewallPolicyId, params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d 的规则分组 %d", params.FirewallPolicyId, params.GroupId)
|
||||
|
||||
firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ func (this *DeleteSetAction) RunPost(params struct {
|
||||
SetId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "删除WAF规则分组 %d 中的规则集 %d", params.GroupId, params.SetId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "删除WAF规则分组 %d 中的规则集 %d", params.GroupId, params.SetId)
|
||||
|
||||
groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId)
|
||||
if err != nil {
|
||||
|
||||
@@ -72,7 +72,7 @@ func (this *CreateIPPopupAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "在WAF策略 %d 名单中添加IP %d", params.FirewallPolicyId, itemId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "在WAF策略 %d 名单中添加IP %d", params.FirewallPolicyId, itemId)
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func (this *DeleteIPAction) RunPost(params struct {
|
||||
ItemId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "从WAF策略 %d 名单中删除IP %d", params.FirewallPolicyId, params.ItemId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "从WAF策略 %d 名单中删除IP %d", params.FirewallPolicyId, params.ItemId)
|
||||
|
||||
// TODO 判断权限
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (this *IndexAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的国家和地区", params.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的国家和地区", params.FirewallPolicyId)
|
||||
|
||||
policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
|
||||
if err != nil {
|
||||
|
||||
@@ -69,7 +69,7 @@ func (this *ProvincesAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的省份", params.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的省份", params.FirewallPolicyId)
|
||||
|
||||
policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
|
||||
if err != nil {
|
||||
|
||||
@@ -55,7 +55,7 @@ func (this *UpdateIPPopupAction) RunPost(params struct {
|
||||
CSRF *actionutils.CSRF
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 名单中的IP %d", params.FirewallPolicyId, params.ItemId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 名单中的IP %d", params.FirewallPolicyId, params.ItemId)
|
||||
|
||||
// TODO 校验ItemId所属用户
|
||||
// TODO 校验IP格式(ipFrom/ipTo)
|
||||
|
||||
@@ -18,7 +18,7 @@ func (this *SortGroupsAction) RunPost(params struct {
|
||||
GroupIds []int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 中的规则分组中的排序", params.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 中的规则分组中的排序", params.FirewallPolicyId)
|
||||
|
||||
firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ func (this *SortSetsAction) RunPost(params struct {
|
||||
SetIds []int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 中的规则集排序", params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 中的规则集排序", params.GroupId)
|
||||
|
||||
groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId)
|
||||
if err != nil {
|
||||
|
||||
@@ -69,7 +69,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 基本信息", params.FirewallPolicyId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 基本信息", params.FirewallPolicyId)
|
||||
|
||||
params.Must.
|
||||
Field("name", params.Name).
|
||||
|
||||
@@ -15,7 +15,7 @@ func (this *UpdateGroupOnAction) RunPost(params struct {
|
||||
IsOn bool
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "设置WAF规则分组 %d 开启状态", params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "设置WAF规则分组 %d 开启状态", params.GroupId)
|
||||
|
||||
_, err := this.RPC().HTTPFirewallRuleGroupRPC().UpdateHTTPFirewallRuleGroupIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleGroupIsOnRequest{
|
||||
FirewallRuleGroupId: params.GroupId,
|
||||
|
||||
@@ -49,7 +49,7 @@ func (this *UpdateGroupPopupAction) RunPost(params struct {
|
||||
Must *actions.Must
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 基本信息", params.GroupId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 基本信息", params.GroupId)
|
||||
|
||||
params.Must.
|
||||
Field("name", params.Name).
|
||||
|
||||
@@ -15,7 +15,7 @@ func (this *UpdateSetOnAction) RunPost(params struct {
|
||||
IsOn bool
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 开启状态", params.SetId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 开启状态", params.SetId)
|
||||
|
||||
_, err := this.RPC().HTTPFirewallRuleSetRPC().UpdateHTTPFirewallRuleSetIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleSetIsOnRequest{
|
||||
FirewallRuleSetId: params.SetId,
|
||||
|
||||
@@ -27,7 +27,7 @@ func (this *UpdateSetPopupAction) RunGet(params struct {
|
||||
SetId int64
|
||||
}) {
|
||||
// 日志
|
||||
this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 基本信息", params.SetId)
|
||||
defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 基本信息", params.SetId)
|
||||
|
||||
this.Data["groupId"] = params.GroupId
|
||||
this.Data["type"] = params.Type
|
||||
|
||||
Reference in New Issue
Block a user