From 7335da976d6abe6613c4fc424186535bfb9f0c2a Mon Sep 17 00:00:00 2001 From: To-om Date: Wed, 14 Apr 2021 16:39:22 +0200 Subject: [PATCH] #1965 Fix customField selection query for alerts --- thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala | 4 +--- thehive/app/org/thp/thehive/services/CustomFieldSrv.scala | 7 ------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala index 33e6294d49..076d7746fe 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala @@ -468,9 +468,7 @@ class PublicAlert @Inject() ( .property("user", UMapping.string)(_.field.updatable) .property("customFields", UMapping.jsonNative)(_.subSelect { case (FPathElem(_, FPathElem(idOrName, _)), alerts) => - alerts - .customFields(EntityIdOrName(idOrName)) - .jsonValue + alerts.customFieldJsonValue(customFieldSrv, EntityIdOrName(idOrName)) case (_, alerts) => alerts.customFields.nameJsonValue.fold.domainMap(JsObject(_)) } .filter[JsValue] { diff --git a/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala b/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala index 5b0c9af5be..9f379b5400 100644 --- a/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala +++ b/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala @@ -131,13 +131,6 @@ object CustomFieldOps { name -> CustomFieldType.map(tpe).getJsonValue(new CustomFieldValueEdge(edge)) } - def jsonValue: Traversal[JsValue, JMap[String, Any], Converter[JsValue, JMap[String, Any]]] = - edgeNameType - .domainMap { - case (edge, _, tpe) => - CustomFieldType.map(tpe).getJsonValue(new CustomFieldValueEdge(edge)) - } - def nameValue: Traversal[(String, Option[_]), JMap[String, Any], Converter[(String, Option[_]), JMap[String, Any]]] = edgeNameType .domainMap {