portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r881539 - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
Date Tue, 17 Nov 2009 21:28:32 GMT
Author: taylor
Date: Tue Nov 17 21:28:32 2009
New Revision: 881539

URL: http://svn.apache.org/viewvc?rev=881539&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-1057
putting real user attributes in top decorator

Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp?rev=881539&r1=881538&r2=881539&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
Tue Nov 17 21:28:32 2009
@@ -32,6 +32,7 @@
 <%
   Jetui jetui = (Jetui)request.getAttribute("jetui");
   RequestContext rc = (RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV);
+  Map userInfo = jetui.getUserAttributes(rc);
   Page portalPage = rc.getPage();
   ColumnLayout columnLayout = (ColumnLayout)request.getAttribute("columnLayout");
   String navContent = jetui.renderPortletWindow("_PageNavigator", "j2-admin::PageNavigator",
rc);
@@ -78,7 +79,7 @@
 &nbsp;<span style='position: absolute; left: 0px; top: 50px;' id='jstbLeftToggle'
class='jstbToggle1'></span><span id='jstbRightToggle' class='jstbToggle2' style='position:
absolute; right: 0px; top: 50px;'></span>
 </div>
 <%if (request.getUserPrincipal() != null) {%>
-<span class="layout-statusarea"><b>David Sean Taylor</b> | Profile | Tasks
(5) | Notifications (2) | <a href="<%=request.getContextPath()%>/login/logout">Log
out</a></span>
+<span class="layout-statusarea"><b><%=userInfo.get("user.name.given")%>
<%=userInfo.get("user.name.family")%></b> | Profile | Tasks (5) | Notifications
(2) | <a href="<%=request.getContextPath()%>/login/logout">Log out</a></span>
 <% } %>
 <!-- <span class="layout-search"><input type='text' size='14'/></span><span
class="layout-search2"><img height='18' src="<%=request.getContextPath()%>/images/search.png"/></span>
 -->
 </div> <!-- end header -->
@@ -96,6 +97,7 @@
     <div class="PContentBorder">
       <div class="PContent"><span style="line-height:0.005px;">&nbsp;</span><%=navContent
%></div>
     </div>
+<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4b0265f81058c137"><img
src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark
and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0265f81058c137"></script>
 </div>
 </div>
 </div>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java?rev=881539&r1=881538&r2=881539&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
Tue Nov 17 21:28:32 2009
@@ -17,7 +17,9 @@
 
 package org.apache.jetspeed.ui;
 
+import java.security.Principal;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.servlet.RequestDispatcher;
@@ -34,6 +36,7 @@
 import org.apache.jetspeed.portlet.HeaderPhaseSupportConstants;
 import org.apache.jetspeed.portlets.layout.ColumnLayout;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.UserSubjectPrincipal;
 import org.apache.jetspeed.util.HeadElementUtils;
 import org.apache.jetspeed.util.KeyValue;
 
@@ -201,5 +204,20 @@
             return "";
         }
     }
-  
+ 
+    public Map getUserAttributes(RequestContext rc)
+    {
+        Map map = null;
+        Principal principal = rc.getRequest().getUserPrincipal();
+        if (principal instanceof UserSubjectPrincipal)
+        {
+            UserSubjectPrincipal jp = (UserSubjectPrincipal)principal;
+            map = jp.getUser().getInfoMap();
+            if (map.get("user.name.given") == null)
+                map.put("user.name.given", "");
+            if (map.get("user.name.family") == null)
+                map.put("user.name.family", jp.getName());            
+        }
+        return map;
+    }
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message