diff --git a/controllers/session.go b/controllers/session.go index 7430ecc6..e5e7c001 100644 --- a/controllers/session.go +++ b/controllers/session.go @@ -127,7 +127,7 @@ func (c *ApiController) DeleteSession() { // @Param id query string true "The id(organization/application/user) of session" // @Param sessionId query string true "sessionId to be checked" // @Success 200 {array} string The Response object -// @router /is-user-session-duplicated [get] +// @router /is-session-duplicated [get] func (c *ApiController) IsSessionDuplicated() { id := c.Input().Get("sessionPkId") sessionId := c.Input().Get("sessionId") diff --git a/object/session.go b/object/session.go index 2540bb95..765fc473 100644 --- a/object/session.go +++ b/object/session.go @@ -75,11 +75,15 @@ func GetSessionCount(owner, field, value string) int { func GetSingleSession(id string) *Session { owner, name, application := util.GetOwnerAndNameAndOtherFromId(id) session := Session{Owner: owner, Name: name, Application: application} - _, err := adapter.Engine.Get(session) + get, err := adapter.Engine.Get(&session) if err != nil { panic(err) } + if !get { + return nil + } + return &session } @@ -126,7 +130,7 @@ func AddSession(session *Session) bool { } } - removeExtraSessionIds(session) + removeExtraSessionIds(dbSession) return UpdateSession(dbSession.GetId(), dbSession) }