Skip to content

Commit

Permalink
Merge pull request #5413 from clarktsiory/bug_24282/display_user_role…
Browse files Browse the repository at this point in the history
…s_on_hover_of_user_profile

Fixes #24282: Display user roles on hover of user profile
  • Loading branch information
fanf committed Feb 29, 2024
2 parents 760a173 + 1d644e6 commit 31587cc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ package com.normation.rudder.web.snippet
import bootstrap.liftweb.RudderConfig
import bootstrap.liftweb.UserLogout
import com.normation.plugins.DefaultExtendableSnippet
import com.normation.rudder.Role
import com.normation.rudder.domain.logger.ApplicationLogger
import com.normation.rudder.users.CurrentUser
import com.normation.utils.DateFormaterService
Expand Down Expand Up @@ -69,13 +70,14 @@ class UserInformation extends DispatchSnippet with DefaultExtendableSnippet[User
case Some(info) => info.name.getOrElse(info.id)
}

val roles = s"User roles : ${Role.toDisplayNames(u.roles).mkString(", ")}"
val lastSession = userRepo.getLastPreviousLogin(u.getUsername).runNow match {
case None => ""
case Some(s) =>
s"Last login on '${DateFormaterService.getDisplayDate(s.creationDate)}' with '${s.authMethod}' authentication"
}

"#openerAccount" #> <span id="openerAccount" title={lastSession}>{displayName}</span>
"#openerAccount" #> <span id="openerAccount" title={List(roles, lastSession).mkString("\n")}>{displayName}</span>

case None =>
S.session.foreach { session =>
Expand Down

0 comments on commit 31587cc

Please sign in to comment.