Skip to content

Commit

Permalink
#1893 Add patternId property in case (type is "patternId")
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 26, 2021
1 parent 468c092 commit 33aacae
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.thp.thehive.services.CaseTemplateOps._
import org.thp.thehive.services.CustomFieldOps._
import org.thp.thehive.services.ObservableOps._
import org.thp.thehive.services.OrganisationOps._
import org.thp.thehive.services.ProcedureOps._
import org.thp.thehive.services.UserOps._
import org.thp.thehive.services._
import play.api.libs.json._
Expand Down Expand Up @@ -313,5 +314,6 @@ class PublicCase @Inject() (
.property("owningOrganisation", UMapping.string)(
_.authSelect((cases, authContext) => cases.origin.visible(authContext).value(_.name)).readonly
)
.property("patternId", UMapping.string.sequence)(_.select(_.procedure.pattern.value(_.patternId)).readonly)
.build
}
2 changes: 2 additions & 0 deletions thehive/app/org/thp/thehive/controllers/v0/DescribeCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class DescribeCtrl @Inject() (
)
case ("dashboard", "status") =>
Some(Seq(PropertyDescription("status", "enumeration", Seq(JsString("Shared"), JsString("Private"), JsString("Deleted")))))
case (_, "patternId") =>
Some(Seq(PropertyDescription("patternId", "patternId", Nil)))
case _ => None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class DescribeCtrl @Inject() (
case (_, "_createdBy") => Some(Seq(PropertyDescription("_createdBy", "user")))
case (_, "_updatedBy") => Some(Seq(PropertyDescription("_updatedBy", "user")))
case (_, "customFields") => Some(customFields)
case (_, "patternId") => Some(Seq(PropertyDescription("patternId", "patternId", Nil)))
case _ => None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class Properties @Inject() (
.property("owningOrganisation", UMapping.string)(
_.authSelect((cases, authContext) => cases.origin.visible(authContext).value(_.name)).readonly
)
.property("procedures", UMapping.entityId.sequence)(_.select(_.procedure.value(_._id)).readonly)
.property("patternId", UMapping.string.sequence)(_.select(_.procedure.pattern.value(_.patternId)).readonly)
.build

lazy val caseTemplate: PublicProperties =
Expand Down

0 comments on commit 33aacae

Please sign in to comment.