Skip to content

Commit

Permalink
#127 Remove unaudited attributes in flow API output
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Feb 21, 2017
1 parent bd112e5 commit c0a04ac
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions thehive-backend/app/controllers/Artifact.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ArtifactCtrl @Inject() (
val withStats = request.body.getBoolean("nstats").getOrElse(false)

val (artifacts, total) = artifactSrv.find(query, range, sort)
val artifactWithCase = auxSrv(artifacts, nparent, withStats)
val artifactWithCase = auxSrv(artifacts, nparent, withStats, true)
renderer.toOutput(OK, artifactWithCase, total)
}

Expand All @@ -106,7 +106,7 @@ class ArtifactCtrl @Inject() (
val sort = request.body.getStrings("sort").getOrElse(Nil)

val (artifacts, total) = artifactSrv.findSimilar(artifact, range, sort)
val artifactWithCase = auxSrv(artifacts, 1, false)
val artifactWithCase = auxSrv(artifacts, 1, false, true)
renderer.toOutput(OK, artifactWithCase, total)
}
}
Expand Down
4 changes: 2 additions & 2 deletions thehive-backend/app/controllers/Case.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CaseCtrl @Inject() (

for {
caze caseSrv.get(id)
casesWithStats auxSrv.apply(caze, 0, withStats.getOrElse(false))
casesWithStats auxSrv.apply(caze, 0, withStats.getOrElse(false), false)
} yield renderer.toOutput(OK, casesWithStats)
}

Expand Down Expand Up @@ -96,7 +96,7 @@ class CaseCtrl @Inject() (
val withStats = request.body.getBoolean("nstats").getOrElse(false)

val (cases, total) = caseSrv.find(query, range, sort)
val casesWithStats = auxSrv.apply(cases, nparent, withStats)
val casesWithStats = auxSrv.apply(cases, nparent, withStats, false)
renderer.toOutput(OK, casesWithStats, total)
}

Expand Down
2 changes: 1 addition & 1 deletion thehive-backend/app/controllers/CaseTemplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CaseTemplateCtrl @Inject() (
val withStats = request.body.getBoolean("nstats").getOrElse(false)

val (caseTemplates, total) = caseTemplateSrv.find(query, range, sort)
val caseTemplatesWithStats = auxSrv(caseTemplates, nparent, withStats)
val caseTemplatesWithStats = auxSrv(caseTemplates, nparent, withStats, false)
renderer.toOutput(OK, caseTemplatesWithStats, total)
}
}
2 changes: 1 addition & 1 deletion thehive-backend/app/controllers/Search.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SearchCtrl @Inject() (
val withStats = request.body.getBoolean("nstats").getOrElse(false)

val (entities, total) = findSrv(None, and(query, "status" ~!= "Deleted", not(or(ofType("audit"), ofType("data"), ofType("user"), ofType("analyzer"), ofType("misp")))), range, sort)
val entitiesWithStats = auxSrv(entities, nparent, withStats)
val entitiesWithStats = auxSrv(entities, nparent, withStats, true)
renderer.toOutput(OK, entitiesWithStats, total)
}
}
2 changes: 1 addition & 1 deletion thehive-backend/app/controllers/Task.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TaskCtrl @Inject() (
val withStats = request.body.getBoolean("stats").getOrElse(false)

val (tasks, total) = taskSrv.find(query, range, sort)
val tasksWithStats = auxSrv.apply(tasks, nparent, withStats)
val tasksWithStats = auxSrv.apply(tasks, nparent, withStats, false)
renderer.toOutput(OK, tasksWithStats, total)
}

Expand Down
2 changes: 1 addition & 1 deletion thehive-backend/app/services/FlowSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FlowSrv @Inject() (
}
}
}
val fObj = auxSrv.apply(audit.objectType(), audit.objectId(), 10, false)
val fObj = auxSrv.apply(audit.objectType(), audit.objectId(), 10, false, true)

for {
summary fSummary
Expand Down
2 changes: 1 addition & 1 deletion thehive-backend/app/services/StreamMessage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object AuditOperationGroup {
}
.collect { case (name, value, Some(attr)) if !attr.isUnaudited (name, value) }
}
val obj = auxSrv(operation.entity, 10, false)
val obj = auxSrv(operation.entity, 10, false, true)
.recover {
case error
log.error("auxSrv fails", error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ReportTemplateCtrl @Inject() (
val withStats = request.body.getBoolean("nstats").getOrElse(false)

val (reportTemplates, total) = reportTemplateSrv.find(query, range, sort)
val reportTemplatesWithStats = auxSrv(reportTemplates, nparent, withStats)
val reportTemplatesWithStats = auxSrv(reportTemplates, nparent, withStats, false)
renderer.toOutput(OK, reportTemplatesWithStats, total)
}

Expand Down

0 comments on commit c0a04ac

Please sign in to comment.