Skip to content

Commit

Permalink
Add JSF function to Gluu library to show displayName or userName #398
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Dec 5, 2016
1 parent d50be8f commit 85bb6a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.gluu.oxtrust.util.jsf;

import org.apache.commons.lang.StringEscapeUtils;
import org.gluu.oxtrust.model.User;
import org.xdi.model.DisplayNameEntry;
import org.xdi.service.LookupService;
import org.xdi.util.StringHelper;
Expand Down Expand Up @@ -107,4 +108,12 @@ public static String getColor(String color, String defaultColor) {
return "#" + tmpColor + ";";
}

public static String getPersonDisplayName(User person) {
if (StringHelper.isEmpty(person.getDisplayName())) {
return person.getUid();
}

return person.getDisplayName();
}

}
5 changes: 3 additions & 2 deletions server/src/main/webapp/WEB-INF/incl/layout/topmenu.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">
xmlns:rich="http://richfaces.org/rich"
xmlns:gluufn="http://www.gluu.org/jsf/functions">

<h:form>
<header class="main-header">
Expand Down Expand Up @@ -33,7 +34,7 @@
<li class="user-header" style="background-color: #222D32 !important;">
<div class="glyphicon glyphicon-user" style="width: 50px;height: 50px;float: left;font-size: 70px;color: #00BE79;"></div>
<p style="font-size: 14px; color: whitesmoke;">
#{currentPerson.displayName}
#{gluufn:getPersonDisplayName(currentPerson)}
</p>
<p style="font-size: 12px; color: whitesmoke;">
<br/>
Expand Down

0 comments on commit 85bb6a6

Please sign in to comment.