Implement session locking with --lock-session option

This commit is contained in:
Dan Sosedoff
2016-11-05 21:23:37 -05:00
parent 97b612c1b3
commit 20da36416c
6 changed files with 59 additions and 22 deletions

View File

@@ -68,6 +68,11 @@ func GetSessions(c *gin.Context) {
}
func Connect(c *gin.Context) {
if command.Opts.LockSession {
c.JSON(400, Error{"Session is locked"})
return
}
var sshInfo *shared.SSHInfo
url := c.Request.FormValue("url")
@@ -114,6 +119,11 @@ func Connect(c *gin.Context) {
}
func Disconnect(c *gin.Context) {
if command.Opts.LockSession {
c.JSON(400, Error{"Session is locked"})
return
}
conn := DB(c)
if conn == nil {
@@ -261,7 +271,10 @@ func GetConnectionInfo(c *gin.Context) {
return
}
c.JSON(200, res.Format()[0])
info := res.Format()[0]
info["session_lock"] = command.Opts.LockSession
c.JSON(200, info)
}
func GetActivity(c *gin.Context) {