From 83bacb3955e0ec0bc86e99b67636b20eeed16acc Mon Sep 17 00:00:00 2001 From: To-om Date: Wed, 14 Oct 2020 15:54:00 +0200 Subject: [PATCH] #1501 Fix richUser for system user --- thehive/app/org/thp/thehive/services/UserSrv.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thehive/app/org/thp/thehive/services/UserSrv.scala b/thehive/app/org/thp/thehive/services/UserSrv.scala index f1d0cb059d..677f11f88d 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -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)) } }