Skip to content

Commit

Permalink
#1316 Rename field in user output: organisations[].role => organisati…
Browse files Browse the repository at this point in the history
…ons[].profile
  • Loading branch information
To-om committed May 23, 2020
1 parent 0b102e3 commit 9d313b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dto/src/main/scala/org/thp/thehive/dto/v1/User.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -33,7 +33,7 @@ case class OutputUser(
permissions: Set[String],
organisation: String,
avatar: Option[String],
organisations: Seq[OutputOrganisationRole]
organisations: Seq[OutputOrganisationProfile]
)

object OutputUser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9d313b3

Please sign in to comment.