portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r925732 - /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
Date Sun, 21 Mar 2010 06:18:32 GMT
Author: rwatler
Date: Sun Mar 21 06:18:31 2010
New Revision: 925732

URL: http://svn.apache.org/viewvc?rev=925732&view=rev
Log:
JS2-902: convert subsite user info key to security attributes key

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=925732&r1=925731&r2=925732&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
Sun Mar 21 06:18:31 2010
@@ -82,6 +82,9 @@ public class JetspeedSecuritySerializer 
     private static String ENCODING_STRING = "JETSPEED-SERIALIZER-ENCODING";
     private static String JETSPEED = "JETSPEED";
 
+    // legacy user info keys
+    private static final String USER_INFO_SUBSITE = "subsite";
+
     private static class ImportRefs
     {
         private HashMap<String, HashMap<String, Principal>> principalMapByType
= new HashMap<String, HashMap<String, Principal>>();
@@ -487,7 +490,17 @@ public class JetspeedSecuritySerializer 
                         
                         for (JSNVPElement element : attributes.getValues())
                         {
-                            userSecAttrs.getAttribute(element.getKey(), true).setStringValue(element.getValue());
+                            // assume old-style user info comes from 2.1.X exports: convert
+                            // user info keys into equivalent 2.2.X security attribute keys
+                            String userInfoKey = element.getKey();
+                            String securityAttributeKey = userInfoKey;
+                            if (userInfoKey.equals(USER_INFO_SUBSITE))
+                            {
+                                securityAttributeKey = User.JETSPEED_USER_SUBSITE_ATTRIBUTE;
+                            }
+                            String securityAttributeValue = element.getValue();
+                            // set security attribute
+                            userSecAttrs.getAttribute(securityAttributeKey, true).setStringValue(securityAttributeValue);
                         }
                     }
                     JSNVPElements jsNVP = jsuser.getSecurityAttributes();



---------------------------------------------------------------------
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