From f5db0e57a07463117900743869f4b06e9437e424 Mon Sep 17 00:00:00 2001 From: To-om Date: Tue, 26 May 2020 10:28:51 +0200 Subject: [PATCH] #1316 When user is in several organisations, select the oldest one at login --- thehive/app/org/thp/thehive/services/UserSrv.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/thehive/app/org/thp/thehive/services/UserSrv.scala b/thehive/app/org/thp/thehive/services/UserSrv.scala index 8e452f84e3..7b119b21d9 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -5,6 +5,7 @@ import java.util.regex.Pattern import gremlin.scala._ import javax.inject.{Inject, Singleton} +import org.apache.tinkerpop.gremlin.process.traversal.Order import org.thp.scalligraph.auth.{AuthContext, AuthContextImpl, Permission} import org.thp.scalligraph.controllers.FFile import org.thp.scalligraph.models._ @@ -208,6 +209,7 @@ class UserSteps(raw: GremlinScala[Vertex])(implicit db: Database, graph: Graph) this .newInstance() .outTo[UserRole] + .order(List(By(Key[Long]("_createdAt"), Order.asc))) .outTo[RoleOrganisation] .value[String](Key("name")) .headOption()