Commit 71d149c4 authored by Eric's avatar Eric

[update] change record commad user format

parent 0fdb5372
......@@ -176,7 +176,7 @@ func (fs *sftpHandler) Filecmd(r *sftp.Request) (err error) {
}
realPathName := suDir.ParsePath(r.Filepath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",fs.user.Name,fs.user.Username),
User: fmt.Sprintf("%s (%s)", fs.user.Name, fs.user.Username),
Hostname: hostDir.asset.Hostname,
OrgID: hostDir.asset.OrgID,
SystemUser: suDir.systemUser.Name,
......@@ -236,7 +236,7 @@ func (fs *sftpHandler) Filewrite(r *sftp.Request) (io.WriterAt, error) {
}
realPathName := suDir.ParsePath(r.Filepath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",fs.user.Name,fs.user.Username),
User: fmt.Sprintf("%s (%s)", fs.user.Name, fs.user.Username),
Hostname: hostDir.asset.Hostname,
OrgID: hostDir.asset.OrgID,
SystemUser: suDir.systemUser.Name,
......@@ -275,7 +275,7 @@ func (fs *sftpHandler) Fileread(r *sftp.Request) (io.ReaderAt, error) {
}
realPathName := suDir.ParsePath(r.Filepath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",fs.user.Name,fs.user.Username),
User: fmt.Sprintf("%s (%s)", fs.user.Name, fs.user.Username),
Hostname: hostDir.asset.Hostname,
OrgID: hostDir.asset.OrgID,
SystemUser: suDir.systemUser.Name,
......@@ -473,7 +473,7 @@ func (c *clientReadWritAt) WriteAt(p []byte, off int64) (n int, err error) {
logger.Debug("WriteAt: ", off)
return 0, c.firstErr
}
if _, err = c.f.Seek(off,0); err != nil{
if _, err = c.f.Seek(off, 0); err != nil {
c.firstErr = err
c.closed = true
_ = c.f.Close()
......@@ -495,7 +495,7 @@ func (c *clientReadWritAt) ReadAt(p []byte, off int64) (n int, err error) {
logger.Debug("ReadAt: ", off)
return 0, c.firstErr
}
if _, err = c.f.Seek(off,0); err != nil{
if _, err = c.f.Seek(off, 0); err != nil {
c.firstErr = err
c.closed = true
_ = c.f.Close()
......
......@@ -280,7 +280,7 @@ func (u *UserVolume) GetFile(path string) (reader io.ReadCloser, err error) {
}
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -356,7 +356,7 @@ func (u *UserVolume) UploadFile(dir, filename string, reader io.Reader) (elfinde
defer fd.Close()
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -448,7 +448,7 @@ func (u *UserVolume) MergeChunk(cid, total int, dirPath, filename string) (elfin
}
filenamePath := filepath.Join(realDirPath, filename)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -548,7 +548,7 @@ func (u *UserVolume) MakeDir(dir, newDirname string) (elfinder.FileDir, error) {
realDirPath := filepath.Join(realPath, newDirname)
err := sysUserVol.client.MkdirAll(realDirPath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -617,7 +617,7 @@ func (u *UserVolume) MakeFile(dir, newFilename string) (elfinder.FileDir, error)
realFilePath := filepath.Join(realPath, newFilename)
_, err := sysUserVol.client.Create(realFilePath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -682,7 +682,7 @@ func (u *UserVolume) Rename(oldNamePath, newName string) (elfinder.FileDir, erro
err := sysUserVol.client.Rename(oldNamePath, newFilePath)
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -748,7 +748,7 @@ func (u *UserVolume) Remove(path string) error {
}
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......@@ -819,7 +819,7 @@ func (u *UserVolume) Paste(dir, filename, suffix string, reader io.ReadCloser) (
realFilePath += suffix
}
logData := &model.FTPLog{
User: fmt.Sprintf("%s(%s)",u.user.Name,u.user.Username),
User: fmt.Sprintf("%s (%s)", u.user.Name, u.user.Username),
Hostname: hostVol.asset.Hostname,
OrgID: hostVol.asset.OrgID,
SystemUser: sysUserVol.systemUser.Name,
......
......@@ -66,7 +66,7 @@ func (s *SwitchSession) Terminate() {
func (s *SwitchSession) recordCommand() {
for command := range s.parser.cmdRecordChan {
if command[0] == ""{
if command[0] == "" {
continue
}
cmd := s.generateCommandResult(command)
......@@ -97,7 +97,7 @@ func (s *SwitchSession) generateCommandResult(command [2]string) *model.Command
OrgID: s.p.Asset.OrgID,
Input: input,
Output: output,
User: s.p.User.Username,
User: fmt.Sprintf("%s (%s)", s.p.User.Name, s.p.User.Username),
Server: s.p.Asset.Hostname,
SystemUser: s.p.SystemUser.Username,
Timestamp: time.Now().Unix(),
......@@ -192,7 +192,7 @@ func (s *SwitchSession) MapData() map[string]interface{} {
}
return map[string]interface{}{
"id": s.ID,
"user": fmt.Sprintf("%s(%s)",s.p.User.Name,s.p.User.Username),
"user": fmt.Sprintf("%s (%s)", s.p.User.Name, s.p.User.Username),
"asset": s.p.Asset.Hostname,
"org_id": s.p.Asset.OrgID,
"login_from": s.p.UserConn.LoginFrom(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment