From 4560cbc6c8484770dbbdb4cadf71de2c5ce2667d Mon Sep 17 00:00:00 2001 From: To-om Date: Wed, 22 Jul 2020 11:41:46 +0200 Subject: [PATCH] #1410 Hide invisible organistions --- 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 09e82778b2..a6041fbfb9 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -272,12 +272,12 @@ class UserSteps(raw: GremlinScala[Vertex])(implicit @Named("with-thehive-schema" .project( _.by .by(_.avatar.fold) - .by(_.role.project(_.by(_.profile).by(_.organisation.name)).fold) + .by(_.role.project(_.by(_.profile).by(_.organisation.visible.name.fold)).fold) ) .map { case (user, attachment, profileOrganisations) => - val po = profileOrganisations.asScala.map { - case (profile, organisationName) => profile.as[Profile] -> organisationName + val po = profileOrganisations.asScala.collect { + case (profile, organisationName) if !organisationName.isEmpty => profile.as[Profile] -> organisationName.get(0) } po.find(_._2 == authContext.organisation) .orElse(po.headOption)