diff --git a/ScalliGraph b/ScalliGraph index 8483ba2e53..24872e76d4 160000 --- a/ScalliGraph +++ b/ScalliGraph @@ -1 +1 @@ -Subproject commit 8483ba2e53867caf7cd0d4a320348d4addd88603 +Subproject commit 24872e76d4b24fea63fdf313b9e1fc655068a5f3 diff --git a/migration/src/main/scala/org/thp/thehive/migration/th4/Output.scala b/migration/src/main/scala/org/thp/thehive/migration/th4/Output.scala index 225a1e3d14..105915ff96 100644 --- a/migration/src/main/scala/org/thp/thehive/migration/th4/Output.scala +++ b/migration/src/main/scala/org/thp/thehive/migration/th4/Output.scala @@ -11,16 +11,16 @@ import org.thp.scalligraph.auth.{AuthContext, AuthContextImpl, UserSrv => UserDB import org.thp.scalligraph.janus.JanusDatabase import org.thp.scalligraph.models._ import org.thp.scalligraph.services._ +import org.thp.scalligraph.traversal.Graph import org.thp.scalligraph.traversal.TraversalOps._ -import org.thp.scalligraph.traversal.{Graph, Traversal} import org.thp.thehive.connector.cortex.models.{CortexSchemaDefinition, TheHiveCortexSchemaProvider} import org.thp.thehive.connector.cortex.services.{ActionSrv, JobSrv} import org.thp.thehive.dto.v1.InputCustomFieldValue -import org.thp.thehive.{migration, ClusterSetup} import org.thp.thehive.migration.IdMapping import org.thp.thehive.migration.dto._ import org.thp.thehive.models._ import org.thp.thehive.services._ +import org.thp.thehive.{migration, ClusterSetup} import play.api.cache.SyncCacheApi import play.api.cache.ehcache.EhCacheModule import play.api.inject.guice.GuiceInjector @@ -143,8 +143,8 @@ class Output @Inject() ( val alertsBuilder = Set.newBuilder[(String, String, String)] db.roTransaction { implicit graph => - Traversal - .V() + graph + .VV() .unsafeHas( "_label", P.within( @@ -265,7 +265,7 @@ class Output @Inject() ( } def updateMetaData(entity: Entity, metaData: MetaData)(implicit graph: Graph): Unit = { - val vertex = Traversal.V(entity._id).head + val vertex = graph.VV(entity._id).head UMapping.date.setProperty(vertex, "_createdAt", metaData.createdAt) UMapping.date.optional.setProperty(vertex, "_updatedAt", metaData.updatedAt) } diff --git a/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala index 9d7cd82ba3..90a3308e1b 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala @@ -94,11 +94,11 @@ class PublicDashboard @Inject() ( Query.init[Traversal.V[Dashboard]]( "listDashboard", (graph, authContext) => - Traversal + graph .union( organisationSrv.filterTraversal(_).get(authContext.organisation).dashboards, userSrv.filterTraversal(_).getByName(authContext.userId).dashboards - )(graph) + ) .dedup ) diff --git a/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala index fa30e87e71..c4d11881dd 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala @@ -82,7 +82,7 @@ class TaskCtrl @Inject() ( .visible(organisationSrv)(authContext) ._id .headOption - .fold[Traversal.V[Task]](Traversal.empty(graph))(c => taskSrv.startTraversal(graph).relatedTo(c)) + .fold[Traversal.V[Task]](graph.empty)(c => taskSrv.startTraversal(graph).relatedTo(c)) ) entrypoint("search task in case") .extract("query", searchParser(query)) diff --git a/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala b/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala index 6f25609282..24caadfa02 100644 --- a/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala +++ b/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala @@ -11,8 +11,8 @@ import org.thp.scalligraph.EntityId import org.thp.scalligraph.auth.AuthContext import org.thp.scalligraph.janus.JanusDatabase import org.thp.scalligraph.models._ +import org.thp.scalligraph.traversal.Graph import org.thp.scalligraph.traversal.TraversalOps._ -import org.thp.scalligraph.traversal.{Graph, Traversal} import org.thp.thehive.services.LocalUserSrv import play.api.Logger @@ -101,17 +101,17 @@ class TheHiveSchemaDefinition @Inject() extends Schema with UpdatableSchema { .addProperty[String]("Taxonomy", "description") .addProperty[Int]("Taxonomy", "version") .dbOperation[Database]("Add Custom taxonomy vertex for each Organisation") { db => - db.tryTransaction { implicit g => + db.tryTransaction { implicit graph => // For each organisation, if there is no custom taxonomy, create it - db.labelFilter("Organisation", Traversal.V()).unsafeHas("name", P.neq("admin")).foreach { o => - val hasFreetagsTaxonomy = Traversal - .V(EntityId(o.id)) + graph.V("Organisation").unsafeHas("name", P.neq("admin")).foreach { o => + val hasFreetagsTaxonomy = graph + .V("Organisation", EntityId(o.id)) .out[OrganisationTaxonomy] .v[Taxonomy] .unsafeHas("namespace", s"_freetags_${o.id()}") .exists if (!hasFreetagsTaxonomy) { - val taxoVertex = g.addVertex("Taxonomy") + val taxoVertex = graph.addVertex("Taxonomy") taxoVertex.property("_label", "Taxonomy") taxoVertex.property("_createdBy", "system@thehive.local") taxoVertex.property("_createdAt", new Date()) diff --git a/thehive/app/org/thp/thehive/services/FlowActor.scala b/thehive/app/org/thp/thehive/services/FlowActor.scala index 73ceeb0ab7..578852f73e 100644 --- a/thehive/app/org/thp/thehive/services/FlowActor.scala +++ b/thehive/app/org/thp/thehive/services/FlowActor.scala @@ -66,7 +66,7 @@ class FlowActor extends Actor { .limit(10) ._id case Some(cid) => - Traversal + graph .union( caseSrv.filterTraversal(_).get(cid).visible(organisationSrv).in[AuditContext], observableSrv.filterTraversal(_).visible(organisationSrv).relatedTo(caseSrv.caseId(cid)).in[AuditContext],