From 1d74258e05e2da10912445a5e8be2eaa5fee5165 Mon Sep 17 00:00:00 2001 From: To-om Date: Tue, 20 Oct 2020 16:45:26 +0200 Subject: [PATCH] #1501 Fix admin profile lookup --- thehive/app/org/thp/thehive/services/UserSrv.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thehive/app/org/thp/thehive/services/UserSrv.scala b/thehive/app/org/thp/thehive/services/UserSrv.scala index 677f11f88d..fe0ed33fdf 100644 --- a/thehive/app/org/thp/thehive/services/UserSrv.scala +++ b/thehive/app/org/thp/thehive/services/UserSrv.scala @@ -233,7 +233,7 @@ object UserOps { .project( _.byValue(_.login) .byValue(_.name) - .by(_.role.filter(_.organisation.get(organisationName)).profile) + .by(_.role.filter(_.organisation.get(organisationName)).profile.fold) .by(_.organisations.get(organisationName).value(_.name).limit(1).fold) ) .domainMap { @@ -241,7 +241,7 @@ object UserOps { val scope = if (org.contains(Organisation.administration.name)) "admin" else "organisation" - val permissions = Permissions.forScope(scope) & profile.permissions + val permissions = Permissions.forScope(scope) & profile.headOption.fold(Set.empty[Permission])(_.permissions) AuthContextImpl(userId, userName, organisationName, requestId, permissions) }