From d6eb9683d1542bef2f1efd905c18ce3d9d49a568 Mon Sep 17 00:00:00 2001 From: "meilin.huang" <954537473@qq.com> Date: Fri, 12 Apr 2024 20:30:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E7=89=88=E6=9C=AC=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mayfly_go_web/package.json | 2 +- mayfly_go_web/src/views/ops/db/DbList.vue | 2 +- mayfly_go_web/src/views/ops/db/SqlExec.vue | 4 ++-- .../views/ops/machine/file/MachineFile.vue | 1 + server/internal/db/api/vo/db.go | 1 - .../db/infrastructure/persistence/db.go | 4 ++-- .../tag/application/resouce_auth_cert.go | 20 ++++++++----------- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/mayfly_go_web/package.json b/mayfly_go_web/package.json index 68b5533d..3c7e538a 100644 --- a/mayfly_go_web/package.json +++ b/mayfly_go_web/package.json @@ -17,7 +17,7 @@ "countup.js": "^2.8.0", "cropperjs": "^1.6.1", "echarts": "^5.5.0", - "element-plus": "^2.6.2", + "element-plus": "^2.7.0", "js-base64": "^3.7.7", "jsencrypt": "^3.3.2", "lodash": "^4.17.21", diff --git a/mayfly_go_web/src/views/ops/db/DbList.vue b/mayfly_go_web/src/views/ops/db/DbList.vue index 2bfaaa01..fbbb88c5 100644 --- a/mayfly_go_web/src/views/ops/db/DbList.vue +++ b/mayfly_go_web/src/views/ops/db/DbList.vue @@ -252,7 +252,7 @@ const columns = ref([ TableColumn.new('type', '类型').isSlot().setAddWidth(-15).alignCenter(), TableColumn.new('instanceName', '实例名'), TableColumn.new('host', 'ip:port').isSlot().setAddWidth(40), - TableColumn.new('username', 'username'), + TableColumn.new('authCertName', '授权凭证'), TableColumn.new('flowProcdefKey', '关联流程'), TableColumn.new('remark', '备注'), ]); diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue index 716268b9..8ac4387c 100644 --- a/mayfly_go_web/src/views/ops/db/SqlExec.vue +++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue @@ -27,8 +27,8 @@ {{ `${dbServerInfo?.version}` }} - - {{ data.params.username }} + + {{ data.params.authCertName }} {{ data.params.remark }} diff --git a/mayfly_go_web/src/views/ops/machine/file/MachineFile.vue b/mayfly_go_web/src/views/ops/machine/file/MachineFile.vue index d5e7e3e1..95b843b8 100755 --- a/mayfly_go_web/src/views/ops/machine/file/MachineFile.vue +++ b/mayfly_go_web/src/views/ops/machine/file/MachineFile.vue @@ -619,6 +619,7 @@ const getDirSize = async (data: any) => { fileId: props.fileId, path: data.path, protocol: props.protocol, + authCertName: props.authCertName, }); data.dirSize = res; } finally { diff --git a/server/internal/db/api/vo/db.go b/server/internal/db/api/vo/db.go index d433905d..9fa95692 100644 --- a/server/internal/db/api/vo/db.go +++ b/server/internal/db/api/vo/db.go @@ -16,7 +16,6 @@ type DbListVO struct { InstanceId *int64 `json:"instanceId"` AuthCertName string `json:"authCertName"` - Username string `json:"username"` InstanceName *string `json:"instanceName"` InstanceType *string `json:"type"` Host string `json:"host"` diff --git a/server/internal/db/infrastructure/persistence/db.go b/server/internal/db/infrastructure/persistence/db.go index 44d0ccd5..9a10ac91 100644 --- a/server/internal/db/infrastructure/persistence/db.go +++ b/server/internal/db/infrastructure/persistence/db.go @@ -19,8 +19,8 @@ func newDbRepo() repository.Db { // 分页获取数据库信息列表 func (d *dbRepoImpl) GetDbList(condition *entity.DbQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) { qd := gormx.NewQueryWithTableName("t_db db"). - Select("db.*, inst.name instance_name, inst.type instance_type, inst.host, inst.port, rac.username "). - Joins("JOIN t_db_instance inst ON db.instance_id = inst.id JOIN t_resource_auth_cert rac ON inst.code = rac.resource_code AND rac.resource_type = 2"). + Select("db.*, inst.name instance_name, inst.type instance_type, inst.host, inst.port "). + Joins("JOIN t_db_instance inst ON db.instance_id = inst.id"). Eq("db.instance_id", condition.InstanceId). Eq("db.id", condition.Id). Like("db.database", condition.Database). diff --git a/server/internal/tag/application/resouce_auth_cert.go b/server/internal/tag/application/resouce_auth_cert.go index 767d423a..07bf54e2 100644 --- a/server/internal/tag/application/resouce_auth_cert.go +++ b/server/internal/tag/application/resouce_auth_cert.go @@ -327,7 +327,7 @@ func (r *resourceAuthCertAppImpl) addAuthCert(ctx context.Context, rac *entity.R if rac.Type == entity.AuthCertTypePublic { rac.ResourceCode = "-" rac.CiphertextEncrypt() - rac.Type = -2 + rac.ResourceType = -2 return r.Insert(ctx, rac) } @@ -428,21 +428,17 @@ func (r *resourceAuthCertAppImpl) updateAuthCertTagName(ctx context.Context, aut // 解密授权凭证信息 func (r *resourceAuthCertAppImpl) decryptAuthCert(authCert *entity.ResourceAuthCert) (*entity.ResourceAuthCert, error) { if authCert.CiphertextType == entity.AuthCertCiphertextTypePublic { - // 需要维持资源关联信息 - resourceCode := authCert.ResourceCode - resourceType := authCert.ResourceType - authCertType := authCert.Type - // 如果是公共授权凭证,则密文为公共授权凭证名称,需要使用该名称再去获取对应的授权凭证 - authCert = &entity.ResourceAuthCert{Name: authCert.Ciphertext} - if err := r.GetBy(authCert); err != nil { + realAuthCert := &entity.ResourceAuthCert{Name: authCert.Ciphertext} + if err := r.GetBy(realAuthCert); err != nil { return nil, errorx.NewBiz("该公共授权凭证[%s]不存在", authCert.Ciphertext) } - // 使用资源关联的凭证类型 - authCert.ResourceCode = resourceCode - authCert.ResourceType = resourceType - authCert.Type = authCertType + // 使用该凭证关联的公共凭证进行密文等内容覆盖 + authCert.Username = realAuthCert.Username + authCert.Ciphertext = realAuthCert.Ciphertext + authCert.CiphertextType = realAuthCert.CiphertextType + authCert.Extra = realAuthCert.Extra } if err := authCert.CiphertextDecrypt(); err != nil {