diff --git a/ScalliGraph b/ScalliGraph index 6a1a6e77bf..b168949a6b 160000 --- a/ScalliGraph +++ b/ScalliGraph @@ -1 +1 @@ -Subproject commit 6a1a6e77bf75933aed4c48cdeaf426f984a43081 +Subproject commit b168949a6b3918306a206d554aa154023533ea14 diff --git a/conf/logback.xml b/conf/logback.xml index 208d14f63e..d8072baa3e 100644 --- a/conf/logback.xml +++ b/conf/logback.xml @@ -37,6 +37,7 @@ + diff --git a/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala index fc8c340add..04064ecfaf 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala @@ -33,7 +33,7 @@ class CaseCtrl @Inject() ( observableSrv: ObservableSrv, userSrv: UserSrv, taskSrv: TaskSrv, - organisationSrv: OrganisationSrv, + val organisationSrv: OrganisationSrv, alertSrv: AlertSrv, db: Database, appConfig: ApplicationConfig diff --git a/thehive/app/org/thp/thehive/controllers/v1/CaseRenderer.scala b/thehive/app/org/thp/thehive/controllers/v1/CaseRenderer.scala index def02c9dc0..3b4325cccf 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/CaseRenderer.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/CaseRenderer.scala @@ -7,6 +7,7 @@ import org.thp.scalligraph.traversal.{Converter, Traversal} import org.thp.thehive.models.{Alert, AlertCase, Case} import org.thp.thehive.services.CaseOps._ import org.thp.thehive.services.OrganisationOps._ +import org.thp.thehive.services.OrganisationSrv import org.thp.thehive.services.ShareOps._ import org.thp.thehive.services.TaskOps._ import play.api.libs.json._ @@ -16,11 +17,20 @@ import java.util.{Collection => JCollection, List => JList, Map => JMap} trait CaseRenderer extends BaseRenderer[Case] { val limitedCountThreshold: Long + val organisationSrv: OrganisationSrv def observableStats(implicit authContext: AuthContext): Traversal.V[Case] => Traversal[JsObject, AnyRef, Converter[JsObject, AnyRef]] = t => t._id.domainMap { caseId => - Json.obj("total" -> t.graph.indexCountQuery(s"""v."_label":Case AND v.relatedId:${caseId.value}""")) + Json.obj( + "total" -> t + .graph + .indexCountQuery( + s"""v."_label":Observable AND """ + + s"v.relatedId:${caseId.value} AND " + + s"v.organisationIds:${organisationSrv.currentId(t.graph, authContext).value}" + ) + ) } // _.share // .observables