diff --git a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala index da88cd00dd..777fe6bd8f 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala @@ -497,7 +497,18 @@ class PublicAlert @Inject() ( case _ => Failure(BadRequestError("Invalid custom fields format")) }) .property("case", db.idMapping)(_.select(_.`case`._id).readonly) - .property("imported", UMapping.boolean)(_.select(_.imported).readonly) + .property("imported", UMapping.boolean)( + _.select(_.imported) + .filter[Boolean]((_, alertTraversal, _, predicate) => + predicate.fold( + b => if (b) alertTraversal else alertTraversal.empty, + p => + if (p.getValue) alertTraversal.has(_.caseId) + else alertTraversal.hasNot(_.caseId) + ) + ) + .readonly + ) .property("importDate", UMapping.date.optional)(_.select(_.importDate).readonly) .property("computed.handlingDuration", UMapping.long)(_.select(_.handlingDuration).readonly) .property("computed.handlingDurationInSeconds", UMapping.long)(_.select(_.handlingDuration.math("_ / 1000").domainMap(_.toLong)).readonly) diff --git a/thehive/app/org/thp/thehive/controllers/v1/Properties.scala b/thehive/app/org/thp/thehive/controllers/v1/Properties.scala index 5a82f5ad7a..05c37ca713 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/Properties.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/Properties.scala @@ -133,7 +133,6 @@ class Properties @Inject() ( case _ => Failure(BadRequestError("Invalid custom fields format")) }) .property("case", db.idMapping)(_.select(_.`case`._id).readonly) - .property("imported", UMapping.boolean)(_.select(_.imported).readonly) .property("importDate", UMapping.date.optional)(_.select(_.importDate).readonly) .property("computed.handlingDuration", UMapping.long)(_.select(_.handlingDuration).readonly) .property("computed.handlingDurationInSeconds", UMapping.long)(_.select(_.handlingDuration.math("_ / 1000").domainMap(_.toLong)).readonly)