mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-04-19 10:45:19 +08:00
fix: 新版本问题修复
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user