Skip to content

Commit

Permalink
#1557 Description now list all alerts merged
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet authored and To-om committed Nov 13, 2020
1 parent 7ce1379 commit d521628
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,17 @@ class AlertCtrl @Inject() (
val alertIds: Seq[String] = request.body("alertIds")
val caseId: String = request.body("caseId")
for {
case0 <- caseSrv.get(EntityIdOrName(caseId)).can(Permissions.manageCase).getOrFail("Case")
_ <- alertIds.toTry { alertId =>
alertSrv
.get(EntityIdOrName(alertId))
.can(Permissions.manageAlert)
.getOrFail("Alert")
.flatMap(alertSrv.mergeInCase(_, case0))
caseSrv.get(EntityIdOrName(caseId))
.can(Permissions.manageCase)
.getOrFail("Case")
.flatMap(`case` =>
alertSrv
.get(EntityIdOrName(alertId))
.can(Permissions.manageAlert)
.getOrFail("Alert")
.flatMap(alertSrv.mergeInCase(_, `case`))
)
}
richCase <- caseSrv.get(EntityIdOrName(caseId)).richCase.getOrFail("Case")
} yield Results.Ok(richCase.toJson)
Expand Down

0 comments on commit d521628

Please sign in to comment.