Skip to content

Commit

Permalink
Merge pull request #529 from jumpserver/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
BaiJiangJie authored Jan 19, 2021
2 parents 4258b6a + c3e3a46 commit 61b3754
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
4 changes: 3 additions & 1 deletion pkg/handler/app_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func (u *UserSelectHandler) displayK8sResult(searchHeader string) {
currentDBS := u.currentResult
term := u.h.term
if len(currentDBS) == 0 {
_, _ = term.Write([]byte(i18n.T("No kubernetes") + "\n\r"))
noK8s := i18n.T("No kubernetes")
utils.IgnoreErrWriteString(term, utils.WrapperString(noK8s, utils.Red))
utils.IgnoreErrWriteString(term, utils.CharNewLine)
utils.IgnoreErrWriteString(term, utils.WrapperString(searchHeader, utils.Green))
utils.IgnoreErrWriteString(term, utils.CharNewLine)
return
Expand Down
4 changes: 3 additions & 1 deletion pkg/handler/app_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func (u *UserSelectHandler) displayMySQLResult(searchHeader string) {
currentDBS := u.currentResult
term := u.h.term
if len(currentDBS) == 0 {
_, _ = term.Write([]byte(i18n.T("No Databases") + "\n\r"))
noDatabases := i18n.T("No Databases")
utils.IgnoreErrWriteString(term, utils.WrapperString(noDatabases, utils.Red))
utils.IgnoreErrWriteString(term, utils.CharNewLine)
utils.IgnoreErrWriteString(term, utils.WrapperString(searchHeader, utils.Green))
utils.IgnoreErrWriteString(term, utils.CharNewLine)
return
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/dbproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (p *DBProxyServer) GenerateRecordCommand(s *commonSwitch, input, output str
OrgID: p.Database.OrgId,
Input: input,
Output: output,
User: fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
User: fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
Server: p.Database.Name,
SystemUser: p.SystemUser.Username,
Timestamp: time.Now().Unix(),
Expand Down Expand Up @@ -311,7 +311,7 @@ func (p *DBProxyServer) MapData(s *commonSwitch) map[string]interface{} {
}
return map[string]interface{}{
"id": s.ID,
"user": fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
"user": fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
"asset": p.Database.Name,
"org_id": p.Database.OrgId,
"login_from": p.UserConn.LoginFrom(),
Expand Down
10 changes: 5 additions & 5 deletions pkg/proxy/k8sproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ func (p *K8sProxyServer) GenerateRecordCommand(s *commonSwitch, input, output st
OrgID: p.Cluster.OrgId,
Input: input,
Output: output,
User: fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
Server: fmt.Sprintf("%s (%s)", p.Cluster.Name, p.Cluster.Attrs.Cluster),
SystemUser: fmt.Sprintf("%s (%s)", p.SystemUser.Name, p.SystemUser.Username),
User: fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
Server: fmt.Sprintf("%s(%s)", p.Cluster.Name, p.Cluster.Attrs.Cluster),
SystemUser: fmt.Sprintf("%s(%s)", p.SystemUser.Name, p.SystemUser.Username),
Timestamp: time.Now().Unix(),
RiskLevel: riskLevel,

Expand Down Expand Up @@ -286,11 +286,11 @@ func (p *K8sProxyServer) MapData(s *commonSwitch) map[string]interface{} {
}
return map[string]interface{}{
"id": s.ID,
"user": fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
"user": fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
"asset": p.Cluster.Name,
"org_id": p.Cluster.OrgId,
"login_from": p.UserConn.LoginFrom(),
"system_user": fmt.Sprintf("%s (%s)", p.SystemUser.Name, p.SystemUser.Username),
"system_user": fmt.Sprintf("%s(%s)", p.SystemUser.Name, p.SystemUser.Username),
"protocol": p.SystemUser.Protocol,
"remote_addr": p.UserConn.RemoteAddr(),
"is_finished": s.finished,
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (p *ProxyServer) MapData(s *commonSwitch) map[string]interface{} {
}
return map[string]interface{}{
"id": s.ID,
"user": fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
"user": fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
"asset": p.Asset.Hostname,
"org_id": p.Asset.OrgID,
"login_from": p.UserConn.LoginFrom(),
Expand Down Expand Up @@ -427,7 +427,7 @@ func (p *ProxyServer) GenerateRecordCommand(s *commonSwitch, input, output strin
OrgID: p.Asset.OrgID,
Input: input,
Output: output,
User: fmt.Sprintf("%s (%s)", p.User.Name, p.User.Username),
User: fmt.Sprintf("%s(%s)", p.User.Name, p.User.Username),
Server: p.Asset.Hostname,
SystemUser: p.SystemUser.Username,
Timestamp: time.Now().Unix(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/srvconn/sftpfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ func (ad *AssetDir) close() {

func (ad *AssetDir) CreateFTPLog(su *model.SystemUser, operate, filename string, isSuccess bool) {
data := model.FTPLog{
User: fmt.Sprintf("%s (%s)", ad.user.Name, ad.user.Username),
User: fmt.Sprintf("%s(%s)", ad.user.Name, ad.user.Username),
Hostname: ad.asset.Hostname,
OrgID: ad.asset.OrgID,
SystemUser: su.Name,
Expand Down

0 comments on commit 61b3754

Please sign in to comment.