Skip to content

Commit

Permalink
#1501 Fix admin profile lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 13, 2020
1 parent eefb972 commit 1d74258
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thehive/app/org/thp/thehive/services/UserSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ 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 {
case (userId, userName, profile, org) =>
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)
}

Expand Down

0 comments on commit 1d74258

Please sign in to comment.