Skip to content

Commit

Permalink
#1501 Fix richUser for system user
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 13, 2020
1 parent 0734ccc commit 83bacb3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions thehive/app/org/thp/thehive/services/UserSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ object UserOps {
)
.domainMap {
case (user, attachment, profileOrganisations) =>
val avatar = attachment.headOption.map(_.attachmentId)
organisation
.fold(id => profileOrganisations.find(_._2.exists(_._1 == id)), name => profileOrganisations.find(_._2.exists(_._2 == name)))
.orElse(profileOrganisations.headOption)
.fold(throw InternalError(s"")) { // FIXME
.fold(RichUser(user, avatar, Profile.admin.name, Set.empty, "no org")) { // fake user (probably "system")
case (profile, organisationIdAndName) =>
val avatar = attachment.headOption.map(_.attachmentId)
RichUser(user, avatar, profile.name, profile.permissions, organisationIdAndName.headOption.fold("***")(_._2))
RichUser(user, avatar, profile.name, profile.permissions, organisationIdAndName.headOption.fold("no org")(_._2))
}
}

Expand Down

0 comments on commit 83bacb3

Please sign in to comment.