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