Skip to content

Commit

Permalink
#1410 Fix error when audit context has been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jul 15, 2020
1 parent 7fb0bd9 commit 6378c06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ScalliGraph
10 changes: 5 additions & 5 deletions thehive/app/org/thp/thehive/services/AuditSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ class AuditSteps(raw: GremlinScala[Vertex])(implicit @Named("with-thehive-schema
.project(
_.by
.by(_.`case`.fold)
.by(_.context)
.by(_.context.fold)
.by(_.`object`.fold)
.by(entityRenderer)
)
.map {
case (audit, context, visibilityContext, obj, renderedObject) =>
val ctx = if (context.isEmpty) visibilityContext else context.get(0)
RichAudit(audit.as[Audit], ctx.asEntity, visibilityContext.asEntity, atMostOneOf[Vertex](obj).map(_.asEntity)) -> renderedObject
.collect {
case (audit, context, visibilityContext, obj, renderedObject) if !context.isEmpty || !visibilityContext.isEmpty =>
val ctx = if (context.isEmpty) visibilityContext.get(0) else context.get(0)
RichAudit(audit.as[Audit], ctx.asEntity, visibilityContext.get(0).asEntity, atMostOneOf[Vertex](obj).map(_.asEntity)) -> renderedObject
}

def forCase(caseId: String): AuditSteps = this.filter(_.`case`.hasId(caseId))
Expand Down

0 comments on commit 6378c06

Please sign in to comment.