diff --git a/build.sbt b/build.sbt index 6704e4c025..ed2b19bc0e 100644 --- a/build.sbt +++ b/build.sbt @@ -63,6 +63,7 @@ libraryDependencies in ThisBuild ++= { dependencyOverrides in ThisBuild ++= Seq( // "org.locationtech.spatial4j" % "spatial4j" % "0.6", // "org.elasticsearch.client" % "elasticsearch-rest-client" % "6.7.2" + akkaActor ) PlayKeys.includeDocumentationInBinary := false milestoneFilter := ((milestone: Milestone) => milestone.title.startsWith("4")) @@ -343,8 +344,6 @@ lazy val thehiveMigration = (project in file("migration")) scopt, specs % Test ), - dependencyOverrides += akkaActor, - fork := true, normalizedName := "migrate" ) diff --git a/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala index c07ea46b3f..c2356f091f 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala @@ -16,7 +16,7 @@ import play.api.libs.json.{JsArray, Json} import play.api.mvc.{Action, AnyContent, Results} import java.io.FileInputStream -import javax.inject.{Inject, Named, Singleton} +import javax.inject.{Inject, Singleton} import scala.util.{Failure, Success, Try} @Singleton @@ -24,7 +24,7 @@ class PatternCtrl @Inject() ( entrypoint: Entrypoint, properties: Properties, patternSrv: PatternSrv, - @Named("with-thehive-schema") implicit val db: Database + db: Database ) extends QueryableCtrl { override val entityName: String = "pattern" override val publicProperties: PublicProperties = properties.pattern diff --git a/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala index ba10c6ce90..02d4f20476 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala @@ -13,14 +13,14 @@ import org.thp.thehive.services.ProcedureOps._ import org.thp.thehive.services.ProcedureSrv import play.api.mvc.{Action, AnyContent, Results} -import javax.inject.{Inject, Named, Singleton} +import javax.inject.{Inject, Singleton} @Singleton class ProcedureCtrl @Inject() ( entrypoint: Entrypoint, properties: Properties, procedureSrv: ProcedureSrv, - @Named("with-thehive-schema") implicit val db: Database + db: Database ) extends QueryableCtrl { override val entityName: String = "procedure" override val publicProperties: PublicProperties = properties.procedure diff --git a/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala index d9fa073a63..acbd82f670 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala @@ -18,7 +18,7 @@ import org.thp.thehive.services.TaskOps._ import org.thp.thehive.services._ import play.api.mvc.{Action, AnyContent, Results} -import javax.inject.{Inject, Named} +import javax.inject.Inject import scala.util.{Failure, Success, Try} class ShareCtrl @Inject() ( @@ -30,7 +30,7 @@ class ShareCtrl @Inject() ( taskSrv: TaskSrv, observableSrv: ObservableSrv, profileSrv: ProfileSrv, - @Named("with-thehive-schema") implicit val db: Database + db: Database ) extends QueryableCtrl { override val entityName: String = "share" override val publicProperties: PublicProperties = properties.share diff --git a/thehive/app/org/thp/thehive/controllers/v1/TaxonomyCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/TaxonomyCtrl.scala index 8432c08d9a..743b778a10 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/TaxonomyCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/TaxonomyCtrl.scala @@ -17,7 +17,7 @@ import org.thp.thehive.services.{TagSrv, TaxonomySrv} import play.api.libs.json.{JsArray, Json} import play.api.mvc.{Action, AnyContent, Results} -import javax.inject.{Inject, Named} +import javax.inject.Inject import scala.collection.JavaConverters._ import scala.util.{Failure, Success, Try} @@ -26,7 +26,7 @@ class TaxonomyCtrl @Inject() ( properties: Properties, taxonomySrv: TaxonomySrv, tagSrv: TagSrv, - @Named("with-thehive-schema") implicit val db: Database + db: Database ) extends QueryableCtrl with TaxonomyRenderer { diff --git a/thehive/app/org/thp/thehive/services/AlertSrv.scala b/thehive/app/org/thp/thehive/services/AlertSrv.scala index d5fe9a70c8..979435bd66 100644 --- a/thehive/app/org/thp/thehive/services/AlertSrv.scala +++ b/thehive/app/org/thp/thehive/services/AlertSrv.scala @@ -586,7 +586,7 @@ object AlertOps { implicit class AlertCustomFieldsOpsDefs(traversal: Traversal.E[AlertCustomField]) extends CustomFieldValueOpsDefs(traversal) } -class AlertIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val db: Database, val service: AlertSrv) extends IntegrityCheckOps[Alert] { +class AlertIntegrityCheckOps @Inject() (val db: Database, val service: AlertSrv) extends IntegrityCheckOps[Alert] { override def check(): Unit = { db.tryTransaction { implicit graph => service diff --git a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala index a3a45e34a2..ceb6837de3 100644 --- a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala +++ b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala @@ -17,12 +17,12 @@ import play.api.cache.SyncCacheApi import play.api.libs.json.JsObject import java.util.{Map => JMap} -import javax.inject.{Inject, Named, Provider, Singleton} +import javax.inject.{Inject, Named, Singleton} import scala.util.{Failure, Success, Try} @Singleton class OrganisationSrv @Inject() ( - taxonomySrvProvider: Provider[TaxonomySrv], +// taxonomySrvProvider: Provider[TaxonomySrv], roleSrv: RoleSrv, profileSrv: ProfileSrv, auditSrv: AuditSrv, @@ -30,7 +30,7 @@ class OrganisationSrv @Inject() ( @Named("integrity-check-actor") integrityCheckActor: ActorRef, cache: SyncCacheApi ) extends VertexSrv[Organisation] { - lazy val taxonomySrv: TaxonomySrv = taxonomySrvProvider.get + lazy val taxonomySrv: TaxonomySrv = ??? //taxonomySrvProvider.get val organisationOrganisationSrv = new EdgeSrv[OrganisationOrganisation, Organisation, Organisation] val organisationShareSrv = new EdgeSrv[OrganisationShare, Organisation, Share] val organisationTaxonomySrv = new EdgeSrv[OrganisationTaxonomy, Organisation, Taxonomy] diff --git a/thehive/app/org/thp/thehive/services/PatternSrv.scala b/thehive/app/org/thp/thehive/services/PatternSrv.scala index 495dff1ef0..414eb85760 100644 --- a/thehive/app/org/thp/thehive/services/PatternSrv.scala +++ b/thehive/app/org/thp/thehive/services/PatternSrv.scala @@ -2,7 +2,7 @@ package org.thp.thehive.services import org.thp.scalligraph.EntityIdOrName import org.thp.scalligraph.auth.AuthContext -import org.thp.scalligraph.models.{Database, Entity} +import org.thp.scalligraph.models.Entity import org.thp.scalligraph.services._ import org.thp.scalligraph.traversal.TraversalOps._ import org.thp.scalligraph.traversal.{Converter, Graph, Traversal} @@ -12,7 +12,7 @@ import org.thp.thehive.services.PatternOps._ import org.thp.thehive.services.ProcedureOps._ import java.util.{Map => JMap} -import javax.inject.{Inject, Named, Singleton} +import javax.inject.{Inject, Singleton} import scala.util.{Success, Try} @Singleton @@ -20,8 +20,6 @@ class PatternSrv @Inject() ( auditSrv: AuditSrv, caseSrv: CaseSrv, organisationSrv: OrganisationSrv -)(implicit - @Named("with-thehive-schema") db: Database ) extends VertexSrv[Pattern] { val patternPatternSrv = new EdgeSrv[PatternPattern, Pattern, Pattern] diff --git a/thehive/app/org/thp/thehive/services/ProcedureSrv.scala b/thehive/app/org/thp/thehive/services/ProcedureSrv.scala index 9448706c3e..9f8624ece9 100644 --- a/thehive/app/org/thp/thehive/services/ProcedureSrv.scala +++ b/thehive/app/org/thp/thehive/services/ProcedureSrv.scala @@ -2,7 +2,7 @@ package org.thp.thehive.services import org.thp.scalligraph.EntityIdOrName import org.thp.scalligraph.auth.AuthContext -import org.thp.scalligraph.models.{Database, Entity} +import org.thp.scalligraph.models.Entity import org.thp.scalligraph.services._ import org.thp.scalligraph.traversal.TraversalOps.TraversalOpsDefs import org.thp.scalligraph.traversal.{Converter, Graph, StepLabel, Traversal} @@ -11,17 +11,14 @@ import org.thp.thehive.models._ import org.thp.thehive.services.ProcedureOps._ import java.util.{Map => JMap} -import javax.inject.{Inject, Named, Singleton} +import javax.inject.{Inject, Singleton} import scala.util.Try @Singleton class ProcedureSrv @Inject() ( auditSrv: AuditSrv, caseSrv: CaseSrv, - organisationSrv: OrganisationSrv, patternSrv: PatternSrv -)(implicit - @Named("with-thehive-schema") db: Database ) extends VertexSrv[Procedure] { val caseProcedureSrv = new EdgeSrv[CaseProcedure, Case, Procedure] val procedurePatternSrv = new EdgeSrv[ProcedurePattern, Procedure, Pattern] diff --git a/thehive/app/org/thp/thehive/services/RoleSrv.scala b/thehive/app/org/thp/thehive/services/RoleSrv.scala index 2f8d1d3959..7d58b977b3 100644 --- a/thehive/app/org/thp/thehive/services/RoleSrv.scala +++ b/thehive/app/org/thp/thehive/services/RoleSrv.scala @@ -12,7 +12,7 @@ import javax.inject.{Inject, Singleton} import scala.util.Try @Singleton -class RoleSrv @Inject() (implicit val db: Database) extends VertexSrv[Role] { +class RoleSrv @Inject() extends VertexSrv[Role] { val roleOrganisationSrv = new EdgeSrv[RoleOrganisation, Role, Organisation] val userRoleSrv = new EdgeSrv[UserRole, User, Role] diff --git a/thehive/app/org/thp/thehive/services/TaxonomySrv.scala b/thehive/app/org/thp/thehive/services/TaxonomySrv.scala index f9fe9e3615..f510103426 100644 --- a/thehive/app/org/thp/thehive/services/TaxonomySrv.scala +++ b/thehive/app/org/thp/thehive/services/TaxonomySrv.scala @@ -2,7 +2,7 @@ package org.thp.thehive.services import org.apache.tinkerpop.gremlin.process.traversal.TextP import org.thp.scalligraph.auth.AuthContext -import org.thp.scalligraph.models.{Database, Entity} +import org.thp.scalligraph.models.Entity import org.thp.scalligraph.services.{EdgeSrv, VertexSrv} import org.thp.scalligraph.traversal.Converter.Identity import org.thp.scalligraph.traversal.TraversalOps.TraversalOpsDefs @@ -13,17 +13,15 @@ import org.thp.thehive.services.OrganisationOps._ import org.thp.thehive.services.TaxonomyOps._ import java.util.{Map => JMap} -import javax.inject.{Inject, Named, Singleton} +import javax.inject.{Inject, Provider, Singleton} import scala.util.{Failure, Success, Try} @Singleton -class TaxonomySrv @Inject() ( - organisationSrv: OrganisationSrv -)(implicit @Named("with-thehive-schema") db: Database) - extends VertexSrv[Taxonomy] { +class TaxonomySrv @Inject() (organisationSrvProvider: Provider[OrganisationSrv]) extends VertexSrv[Taxonomy] { - val taxonomyTagSrv = new EdgeSrv[TaxonomyTag, Taxonomy, Tag] - val organisationTaxonomySrv = new EdgeSrv[OrganisationTaxonomy, Organisation, Taxonomy] + lazy val organisationSrv: OrganisationSrv = organisationSrvProvider.get + val taxonomyTagSrv = new EdgeSrv[TaxonomyTag, Taxonomy, Tag] + val organisationTaxonomySrv = new EdgeSrv[OrganisationTaxonomy, Organisation, Taxonomy] def create(taxo: Taxonomy, tags: Seq[Tag with Entity])(implicit graph: Graph, authContext: AuthContext): Try[RichTaxonomy] = for { diff --git a/thehive/app/org/thp/thehive/services/UserSrv.scala b/thehive/app/org/thp/thehive/services/UserSrv.scala index 9fffac1c10..f641c2c155 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -32,8 +32,7 @@ class UserSrv @Inject() ( roleSrv: RoleSrv, auditSrv: AuditSrv, attachmentSrv: AttachmentSrv, - @Named("integrity-check-actor") integrityCheckActor: ActorRef, - implicit val db: Database + @Named("integrity-check-actor") integrityCheckActor: ActorRef ) extends VertexSrv[User] { val defaultUserDomain: Option[String] = configuration.getOptional[String]("auth.defaultUserDomain") val fullUserNameRegex: Pattern = "[\\p{Graph}&&[^@.]](?:[\\p{Graph}&&[^@]]*)*@\\p{Alnum}+(?:[\\p{Alnum}-.])*".r.pattern