-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1766 Add procedure query in case and extraData in procedure
- Loading branch information
Showing
6 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
thehive/app/org/thp/thehive/controllers/v1/ProcedureRenderer.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.thp.thehive.controllers.v1 | ||
|
||
import org.thp.scalligraph.traversal.{Converter, Traversal} | ||
import org.thp.thehive.controllers.v1.Conversion._ | ||
import org.thp.thehive.models.Procedure | ||
import org.thp.thehive.services.PatternOps._ | ||
import org.thp.thehive.services.ProcedureOps._ | ||
import play.api.libs.json.JsValue | ||
|
||
import java.util.{Map => JMap} | ||
|
||
trait ProcedureRenderer extends BaseRenderer[Procedure] { | ||
def patternStats: Traversal.V[Procedure] => Traversal[JsValue, JMap[String, Any], Converter[JsValue, JMap[String, Any]]] = | ||
_.pattern.richPattern.domainMap(_.toJson) | ||
|
||
def procedureStatsRenderer(extraData: Set[String]): Traversal.V[Procedure] => JsTraversal = { implicit traversal => | ||
baseRenderer( | ||
extraData, | ||
traversal, | ||
{ | ||
case (f, "pattern") => addData("pattern", f)(patternStats) | ||
case (f, _) => f | ||
} | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters