From da241e9cbb974d9be808477bd7393896e7f398f9 Mon Sep 17 00:00:00 2001 From: Zhang Dongliang Date: Wed, 17 Oct 2018 15:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=BB=91=E5=90=8D=E5=8D=95=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9C=8D=E5=8A=A1=E7=9A=84=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/logclient/logclient.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/util/logclient/logclient.go b/pkg/util/logclient/logclient.go index 655d9ab0cb..066cb0e8ee 100644 --- a/pkg/util/logclient/logclient.go +++ b/pkg/util/logclient/logclient.go @@ -56,6 +56,9 @@ const ( ACT_VM_UNBIND_KEYPAIR = "解绑密钥" ) +// golang 不支持 const 的string array, http://t.cn/EzAvbw8 +var BLACK_LIST_OBJ_TYPE = []string{"parameter"} + var logclientWorkerMan *appsrv.WorkerManager func init() { @@ -73,7 +76,13 @@ func AddActionLog(model IObject, action string, iNotes interface{}, userCred mcc token := userCred notes := stringutils.Interface2String(iNotes) - // s := auth.GetSession(userCred, "", "") + // 忽略不黑名单里的资源类型 + for _, v := range BLACK_LIST_OBJ_TYPE { + if v == model.Keyword() { + log.Errorf("不支持的 actionlog 类型") + return + } + } objId := model.GetId() if len(objId) == 0 {