[portal-commits] JBoss Portal SVN: r9074 - in branches/JBoss_Portal_Branch_2_6/core-identity/src: main/org/jboss/portal/core/identity/ui/actions and 4 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Thu Nov 22 05:44:22 EST 2007


Author: emuckenhuber
Date: 2007-11-22 05:44:22 -0500 (Thu, 22 Nov 2007)
New Revision: 9074

Modified:
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
   branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
   branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
   branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml
Log:
JBPORTAL-1732: utf8 encoding for params

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -22,6 +22,8 @@
  ******************************************************************************/
 package org.jboss.portal.core.identity.ui;
 
+import org.jboss.portal.common.text.FastURLEncoder;
+
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
@@ -74,13 +76,8 @@
       return attribute;
    }
    
-   /**
-    * Used for GET parameters - username does never contain a escape char
-    * 
-    * @return double escaped username
-    */
-   public String getEscapedUsername()
+   public String getUTF8Username()
    {
-      return username.replace("\\", "\\\\");
+      return FastURLEncoder.getUTF8Instance().encode(username);
    }
 }

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -30,6 +30,7 @@
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.ui.IdentityUIUser;
 import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
 import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
@@ -56,6 +57,9 @@
 
    /** .*/
    private IdentityRoleBean identityRoleBean;
+   
+   /** . */
+   private final static FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    public IdentityUIUser getUiUser()
    {
@@ -102,7 +106,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentUser = (String) params.get("currentUser");
+      this.currentUser = decoder.encode((String) params.get("currentUser"));
       if (this.currentUser != null)
       {
          this.uiUser = new IdentityUIUser(this.currentUser);

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -35,6 +35,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.portal.api.node.PortalNode;
 import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.services.IdentityConstants;
 import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
 import org.jboss.portal.core.identity.ui.IdentityUIUser;
@@ -72,6 +73,8 @@
    
    /** . */ 
    private ValidateEmailService validateEmailService;
+   
+   private final static FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    /** . */
    private static final Logger log = Logger.getLogger(EditProfileAction.class);
@@ -201,7 +204,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentUser = (String) params.get("currentUser");
+      this.currentUser = decoder.encode((String) params.get("currentUser"));
       this.windowState = null;
       if (this.currentUser == null)
       {
@@ -267,7 +270,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentUser = (String) params.get("currentUser");
+      this.currentUser = decoder.encode((String) params.get("currentUser"));
       
      return "adminChangePassword";
    }

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -27,6 +27,7 @@
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.ui.UIRole;
 import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
 
@@ -45,6 +46,9 @@
 
    /** .*/
    private IdentityRoleBean identityRoleBean;
+   
+   /** . */
+   private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    public UIRole getUiRole()
    {
@@ -71,7 +75,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentRole = (String) params.get("currentRole");
+      this.currentRole = decoder.encode((String) params.get("currentRole"));
       try
       {
          this.uiRole = identityRoleBean.getUIRole(this.currentRole);

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -34,6 +34,7 @@
 import javax.faces.context.FacesContext;
 
 import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.services.IdentityConstants;
 import org.jboss.portal.core.identity.services.IdentityMailService;
 import org.jboss.portal.core.identity.ui.IdentityUIUser;
@@ -64,6 +65,9 @@
 
    /** . */
    private static final Logger log = Logger.getLogger(LostPasswordAction.class);
+   
+   /** . */
+   private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    public String getUsername()
    {
@@ -185,7 +189,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.username =  (String) params.get("currentUser");
+      this.username =  decoder.encode((String) params.get("currentUser"));
       return "resetPassword";
    }
 

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -36,6 +36,7 @@
 import javax.faces.model.ListDataModel;
 
 import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.ui.IdentityUIUser;
 import org.jboss.portal.core.identity.ui.UIRole;
 import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
@@ -72,6 +73,9 @@
    
    /** The logger */
    private static final Logger log = Logger.getLogger(RoleManagementBean.class);
+   
+   /** The decoder */
+   private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    public IdentityRoleBean getIdentityRoleBean()
    {
@@ -150,7 +154,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      String role = (String) params.get("currentRole");
+      String role = decoder.encode((String) params.get("currentRole"));
       this.currentRole = role != null ? role : this.currentRole;
       try
       {
@@ -207,7 +211,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentRole = (String) params.get("currentRole");
+      this.currentRole = decoder.encode((String) params.get("currentRole"));
       if (this.currentRole != null)
       {
          try

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java	2007-11-22 10:44:22 UTC (rev 9074)
@@ -36,6 +36,7 @@
 import javax.faces.model.ListDataModel;
 
 import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
 import org.jboss.portal.core.identity.services.IdentityConstants;
 import org.jboss.portal.core.identity.services.metadata.CoreIdentityConfigurationException;
 import org.jboss.portal.core.identity.services.workflow.RegistrationService;
@@ -105,6 +106,9 @@
 
    /** . */
    private static final Logger log = Logger.getLogger(UserAdministrationBean.class);
+   
+   /** The decoder */
+   private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
 
    public UserAdministrationBean()
    {
@@ -257,7 +261,7 @@
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
       String action = (String) params.get("enableAction");
-      this.currentUser = (String) params.get("currentUser");
+      this.currentUser = decoder.encode((String) params.get("currentUser"));
       
       // TODO - do something better than .equals("admin")
       if (this.currentUser != null && action != null && ! this.currentUser.equals("admin"))
@@ -344,7 +348,7 @@
       FacesContext ctx = FacesContext.getCurrentInstance();
       ExternalContext ectx = ctx.getExternalContext();
       Map params = ectx.getRequestParameterMap();
-      this.currentUser = (String) params.get("currentUser");
+      this.currentUser = decoder.encode((String) params.get("currentUser"));
       if (this.currentUser != null)
       {
          this.uiUser = new IdentityUIUser(this.currentUser);

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml	2007-11-22 10:44:22 UTC (rev 9074)
@@ -64,11 +64,11 @@
 		</f:facet>
 		<h:commandLink action="#{editprofilemgr.adminEditProfile}" styleClass="actionRename">
 			<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE}"/>
-			<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+			<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 		</h:commandLink> | 
 		<h:commandLink action="#{assignrolemgr.assignRoles}" styleClass="actionPreferences">
 			<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_ROLES}"/>
-			<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+			<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 	    </h:commandLink>
 	</h:column>
 	</h:dataTable>

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml	2007-11-22 10:44:22 UTC (rev 9074)
@@ -74,20 +74,20 @@
 		</f:facet>
 		<h:commandLink action="#{editprofilemgr.adminEditProfile}" styleClass="actionRename">
 			<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE}"/>
-			<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+			<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 		</h:commandLink> | 
 		<h:commandLink action="#{assignrolemgr.assignRoles}" styleClass="actionProperties">
 			<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_ROLES}"/>
-			<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+			<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 	    </h:commandLink> | 
 		<h:commandLink action="#{useradministrationbean.enableUser}" styleClass="#{uiUser.attribute.enabled == true ? 'actionDefault' : 'actionMakeDefault'}">
 			<h:outputText value="#{uiUser.attribute.enabled == true ? bundle.IDENTITY_MANAGEMENT_DISABLE : bundle.IDENTITY_MANAGEMENT_ENABLE}" />
-			<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+			<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 			<f:param name="enableAction" value="#{uiUser.attribute.enabled == true ? 'disable' : 'enable'}" />
 		</h:commandLink> | 
 	    <h:commandLink action="#{useradministrationbean.deleteUser}" styleClass="actionDelete">
 	    	<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_DELETE}"/>
-	    	<f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+	    	<f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
 	    </h:commandLink>
 	</h:column>
 	</h:dataTable>

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml	2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml	2007-11-22 10:44:22 UTC (rev 9074)
@@ -50,7 +50,7 @@
 			  	<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
 				<h:commandLink action="#{lostpasswordmgr.adminResetPassword}">
 					<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_RESET_PASSWORD}" />
-					<f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+					<f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
 				</h:commandLink> 
 				<h:panelGroup />
 			</c:when>
@@ -58,7 +58,7 @@
 			  	<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
 				<h:commandLink action="#{manager.adminChangePassword}">
 					<h:outputText value="#{bundle.IDENTITY_EDIT_CHANGE_PASSWORD}" />
-					<f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+					<f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
 				</h:commandLink>
 				<h:panelGroup />						
 			</c:otherwise>
@@ -81,7 +81,7 @@
 		  	<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
 			<h:commandLink action="changePassword">
 				<h:outputText value="#{bundle.IDENTITY_EDIT_CHANGE_PASSWORD}" />
-				<f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+				<f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
 			</h:commandLink>
 			<h:panelGroup />	
 	</c:otherwise>




More information about the portal-commits mailing list