portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r692456 - /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
Date Fri, 05 Sep 2008 15:13:10 GMT
Author: ate
Date: Fri Sep  5 08:13:09 2008
New Revision: 692456

URL: http://svn.apache.org/viewvc?rev=692456&view=rev
Log:
more fixes and implemention of association handling

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=692456&r1=692455&r2=692456&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
Fri Sep  5 08:13:09 2008
@@ -262,6 +262,17 @@
                                                             PrincipalNotRemovableException,
DependentPrincipalException
     {
         validatePrincipal(principal);
+        for (JetspeedPrincipalAssociationHandler jpah : assHandlers.values())
+        {
+            if (jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName()))
+            {
+                jpah.removeAllFrom(principal);
+            }
+            else
+            {
+                jpah.removeAllTo(principal);
+            }
+        }
         jpsm.removePrincipal(principal);
     }
 
@@ -298,20 +309,20 @@
     //
     public void addAssociation(String associationName, JetspeedPrincipal from, JetspeedPrincipal
to) throws PrincipalNotFoundException, PrincipalAssociationNotAllowedException
     {
-        AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(),
to.getName());
+        AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(),
to.getType().getName());        
+        JetspeedPrincipalAssociationHandler jpah = assHandlers.get(key);
         
-        if (!assHandlers.containsKey(key))
+        if (jpah == null)
         {
             throw new PrincipalAssociationNotAllowedException();
         }
         
-        JetspeedPrincipalAssociationHandler jpah = assHandlers.get(key);
         jpah.add(from, to);
     }
 
     public void removeAssociation(String associationName, JetspeedPrincipal from, JetspeedPrincipal
to) throws PrincipalNotFoundException, PrincipalAssociationRequiredException
     {
-        AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(),
to.getName());
+        AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(),
to.getType().getName());
         JetspeedPrincipalAssociationHandler jpah = assHandlers.get(key);
         
         if (jpah != null)



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