From 9d313b3d36864fdbcd435d6dff840ddb29569eec Mon Sep 17 00:00:00 2001 From: To-om Date: Sat, 23 May 2020 07:54:41 +0200 Subject: [PATCH] #1316 Rename field in user output: organisations[].role => organisations[].profile --- dto/src/main/scala/org/thp/thehive/dto/v1/User.scala | 8 ++++---- .../app/org/thp/thehive/controllers/v1/Conversion.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dto/src/main/scala/org/thp/thehive/dto/v1/User.scala b/dto/src/main/scala/org/thp/thehive/dto/v1/User.scala index 77042220a0..3cb0736b3d 100644 --- a/dto/src/main/scala/org/thp/thehive/dto/v1/User.scala +++ b/dto/src/main/scala/org/thp/thehive/dto/v1/User.scala @@ -12,9 +12,9 @@ object InputUser { implicit val writes: Writes[InputUser] = Json.writes[InputUser] } -case class OutputOrganisationRole(organisation: String, role: String) -object OutputOrganisationRole { - implicit val format: OFormat[OutputOrganisationRole] = Json.format[OutputOrganisationRole] +case class OutputOrganisationProfile(organisation: String, profile: String) +object OutputOrganisationProfile { + implicit val format: OFormat[OutputOrganisationProfile] = Json.format[OutputOrganisationProfile] } case class OutputUser( @@ -33,7 +33,7 @@ case class OutputUser( permissions: Set[String], organisation: String, avatar: Option[String], - organisations: Seq[OutputOrganisationRole] + organisations: Seq[OutputOrganisationProfile] ) object OutputUser { diff --git a/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala b/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala index f003e91233..60ad71f478 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala @@ -199,7 +199,7 @@ object Conversion { .into[OutputUser] .withFieldComputed(_.permissions, _.permissions.asInstanceOf[Set[String]]) .withFieldComputed(_.hasKey, _.apikey.isDefined) - .withFieldConst(_.organisations, organisations.map { case (org, role) => OutputOrganisationRole(org, role) }) + .withFieldConst(_.organisations, organisations.map { case (org, role) => OutputOrganisationProfile(org, role) }) .withFieldComputed(_.avatar, user => user.avatar.map(avatar => s"/api/v1/user/${user._id}/avatar/$avatar")) .transform }