portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r785896 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/ components/jetspeed-serializer/src/m...
Date Thu, 18 Jun 2009 04:40:52 GMT
Author: rwatler
Date: Thu Jun 18 04:40:51 2009
New Revision: 785896

URL: http://svn.apache.org/viewvc?rev=785896&view=rev
Log:
JS2-1034: ETL migration serialization bug fixes

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=785896&r1=785895&r2=785896&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
Thu Jun 18 04:40:51 2009
@@ -682,6 +682,7 @@
         Criteria criteria = new Criteria();
         criteria.addEqualTo("type", permission.getType());
         criteria.addEqualTo("name", permission.getName());
+        criteria.addEqualTo("actions", permission.getActions());
         Query query = QueryFactory.newQuery(PersistentJetspeedPermissionImpl.class, criteria);
         return getPersistenceBrokerTemplate().getCount(query) == 1;
     }

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=785896&r1=785895&r2=785896&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
Thu Jun 18 04:40:51 2009
@@ -25,6 +25,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.security.auth.Subject;
 
@@ -869,16 +870,21 @@
             
             for (JetspeedPrincipal principal : principalManager.getPrincipals(""))
             {
+                Set<String> associationNames = new HashSet<String>();
                 for (JetspeedPrincipalAssociationType assocType : principalManager.getAssociationTypes())
                 {
-                    for (String otherPrincipalTypeName : copiedPrincipalTypes.keySet())
+                    String associationName = assocType.getAssociationName();
+                    if (associationNames.add(associationName))
                     {
-                        otherPrincipalManager = this.principalManagerProvider.getManager(this.principalManagerProvider.getPrincipalType(otherPrincipalTypeName));
-                        
-                        for (JetspeedPrincipal toPrincipal : otherPrincipalManager.getAssociatedFrom(principal.getName(),
principal.getType(), assocType.getAssociationName()))
+                        for (String otherPrincipalTypeName : copiedPrincipalTypes.keySet())
                         {
-                            JSPrincipalAssociation jsAssoc = createJSPrincipalAssociation(assocType,
principal, toPrincipal);
-                            snapshot.addPrincipalAssociation(jsAssoc);
+                            otherPrincipalManager = this.principalManagerProvider.getManager(this.principalManagerProvider.getPrincipalType(otherPrincipalTypeName));
+                            
+                            for (JetspeedPrincipal toPrincipal : otherPrincipalManager.getAssociatedFrom(principal.getName(),
principal.getType(), associationName))
+                            {
+                                JSPrincipalAssociation jsAssoc = createJSPrincipalAssociation(associationName,
principal, toPrincipal);
+                                snapshot.addPrincipalAssociation(jsAssoc);
+                            }
                         }
                     }
                 }
@@ -886,10 +892,10 @@
         }
     }
     
-    private JSPrincipalAssociation createJSPrincipalAssociation(JetspeedPrincipalAssociationType
assocType, JetspeedPrincipal from, JetspeedPrincipal to)
+    private JSPrincipalAssociation createJSPrincipalAssociation(String associationName, JetspeedPrincipal
from, JetspeedPrincipal to)
     {
         JSPrincipalAssociation jsAssoc = new JSPrincipalAssociation();
-        jsAssoc.setName(assocType.getAssociationName());
+        jsAssoc.setName(associationName);
         jsAssoc.setFromType(from.getType().getName());
         jsAssoc.setFromName(from.getName());
         jsAssoc.setToType(to.getType().getName());
@@ -989,7 +995,7 @@
         _jsPrincipal.setRemovable(principal.isRemovable());
         _jsPrincipal.setExtendable(principal.isExtendable());
         
-        if (JetspeedPrincipalType.USER.equals(principal.getType()))
+        if (JetspeedPrincipalType.USER.equals(principal.getType().getName()))
         {
             Credential credential = userManager.getPasswordCredential((User) principal);
             Subject subject = userManager.getSubject((User) principal);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java?rev=785896&r1=785895&r2=785896&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSUser.java
Thu Jun 18 04:40:51 2009
@@ -376,6 +376,15 @@
 		                g.attributes  = (JSSecurityAttributes) o1;
                     else if (o1 instanceof JSPrincipalRules)
 	                    g.rules  = (JSPrincipalRules) o1;
+                    else if (o1 instanceof JSNVPElements)
+                    {
+                        g.attributes  = new JSSecurityAttributes();
+                        for (JSNVPElement element : ((JSNVPElements)o1).getValues())
+                        {
+                            JSNVPElement clonedElement = new JSNVPElement(element.getKey(),
element.getValue());
+                            g.attributes.add(clonedElement);
+                        }
+                    }
                 }
             } 
             catch (Exception e)

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml?rev=785896&r1=785895&r2=785896&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
Thu Jun 18 04:40:51 2009
@@ -111,7 +111,8 @@
         <unique name="UIX_SECURITY_PERMISSION">
           <unique-column name="PERMISSION_TYPE" />
           <unique-column name="NAME" />
-        </unique>        
+          <unique-column name="ACTIONS" />
+        </unique>
     </table>
     
     <!--



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