Skip to content

Commit

Permalink
#1670 Make tag updatable
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 3, 2021
1 parent 667bb7a commit dd3d78b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions dto/src/main/scala/org/thp/thehive/dto/v1/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ package org.thp.thehive.dto.v1

import play.api.libs.json.{Json, OFormat}

import java.util.Date

case class OutputTag(
_id: String,
_type: String,
_createdBy: String,
_updatedBy: Option[String] = None,
_createdAt: Date,
_updatedAt: Option[Date] = None,
namespace: String,
predicate: String,
value: Option[String],
Expand Down
6 changes: 6 additions & 0 deletions thehive/app/org/thp/thehive/controllers/v1/Conversion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ object Conversion {
tag
.asInstanceOf[Tag]
.into[OutputTag]
.withFieldConst(_._id, tag._id.toString)
.withFieldConst(_._updatedAt, tag._updatedAt)
.withFieldConst(_._updatedBy, tag._updatedBy)
.withFieldConst(_._createdAt, tag._createdAt)
.withFieldConst(_._createdBy, tag._createdBy)
.withFieldConst(_._type, "Profile")
.withFieldComputed(_.namespace, t => if (t.isFreeTag) "_freetags_" else t.namespace)
.transform
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TheHiveQueryExecutor @Inject() (
procedureCtrl: ProcedureCtrl,
profileCtrl: ProfileCtrl,
shareCtrl: ShareCtrl,
tagCtrl: TagCtrl,
taskCtrl: TaskCtrl,
userCtrl: UserCtrl,
taxonomyCtrl: TaxonomyCtrl,
Expand All @@ -59,7 +60,7 @@ class TheHiveQueryExecutor @Inject() (
procedureCtrl,
profileCtrl,
shareCtrl,
// tagCtrl,
tagCtrl,
taskCtrl,
userCtrl,
taxonomyCtrl
Expand Down

0 comments on commit dd3d78b

Please sign in to comment.