修复普通用户访问非自己创建的资产无法打开原生ssh的bug

This commit is contained in:
dushixiang
2021-05-16 17:32:21 +08:00
committed by dushixiang
parent f8c29b23b9
commit d33779ac34
5 changed files with 21 additions and 38 deletions

View File

@ -142,6 +142,22 @@ func (r AssetRepository) Find(pageIndex, pageSize int, name, protocol, tags stri
if o == nil {
o = make([]model.AssetForPage, 0)
} else {
for i := 0; i < len(o); i++ {
if o[i].Protocol == "ssh" {
attributes, err := r.FindAttrById(o[i].ID)
if err != nil {
continue
}
for j := range attributes {
if attributes[j].Name == constant.SshMode {
o[i].SshMode = attributes[j].Value
break
}
}
}
}
}
return
}