portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r736506 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src: main/java/org/apache/jetspeed/security/spi/impl/ test/java/org/apache/jetspeed/security/
Date Thu, 22 Jan 2009 00:26:29 GMT
Author: ate
Date: Wed Jan 21 16:26:29 2009
New Revision: 736506

URL: http://svn.apache.org/viewvc?rev=736506&view=rev
Log:
Fixing the security association (OJB) query criteria configuration which needed to be adjusted
for the domain extension.
This also fixes the previously broken TestGroupManager and TestRoleManager 

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/test/java/org/apache/jetspeed/security/TestGroupManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java

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=736506&r1=736505&r2=736506&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
Wed Jan 21 16:26:29 2009
@@ -128,8 +128,8 @@
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.name", principalFromName);
         criteria.addEqualTo("type", to.getName());
-        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
         criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("domainId", toSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new
ManagedListByQueryCallback(query));
     }
@@ -146,8 +146,8 @@
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.name", principalToName);
         criteria.addEqualTo("type", from.getName());
-        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
         criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("domainId", fromSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new
ManagedListByQueryCallback(query));
     }
@@ -164,8 +164,8 @@
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.id", principalFromId);
         criteria.addEqualTo("type", to.getName());
-        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
         criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("domainId", toSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new
ManagedListByQueryCallback(query));
     }
@@ -182,8 +182,8 @@
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.id", principalToId);
         criteria.addEqualTo("type", from.getName());
-        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
         criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("domainId", fromSecurityDomain);
         Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
         return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new
ManagedListByQueryCallback(query));
     }
@@ -200,8 +200,8 @@
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.name", principalFromName);
         criteria.addEqualTo("type", to.getName());
-        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
-        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("domainId", toSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -224,8 +224,8 @@
         criteria.addEqualTo("associationsTo.associationName", associationName);
         criteria.addEqualTo("associationsTo.from.id", principalFromId);
         criteria.addEqualTo("type", to.getName());
-        criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
         criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
+        criteria.addEqualTo("domainId", toSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -248,8 +248,8 @@
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.name", principalToName);
         criteria.addEqualTo("type", from.getName());
-        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
         criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("domainId", fromSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();
@@ -272,8 +272,8 @@
         criteria.addEqualTo("associationsFrom.associationName", associationName);
         criteria.addEqualTo("associationsFrom.to.id", principalToId);
         criteria.addEqualTo("type", from.getName());
-        criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
         criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
+        criteria.addEqualTo("domainId", fromSecurityDomain);
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name"});
         ArrayList<String> names = new ArrayList<String>();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java?rev=736506&r1=736505&r2=736506&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestGroupManager.java
Wed Jan 21 16:26:29 2009
@@ -328,15 +328,15 @@
             assertTrue("failed to init testRemoveUserFromGroup(), " + sex, false);
         }
 
-//DST        try
-//        {
-//            boolean isUserInGroup = gms.isUserInGroup("anonuser3", "testgroup1.group1");
-//            assertTrue("anonuser3 should be in group testgroup1.group1", isUserInGroup);
-//        }
-//        catch (SecurityException sex)
-//        {
-//            assertTrue("user and group exist. should not have thrown an exception: " +
sex, false);
-//        }
+        try
+        {
+            boolean isUserInGroup = gms.isUserInGroup("anonuser3", "testgroup1.group1");
+            assertTrue("anonuser3 should be in group testgroup1.group1", isUserInGroup);
+        }
+        catch (SecurityException sex)
+        {
+            assertTrue("user and group exist. should not have thrown an exception: " + sex,
false);
+        }
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java?rev=736506&r1=736505&r2=736506&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRoleManager.java
Wed Jan 21 16:26:29 2009
@@ -267,15 +267,15 @@
             assertTrue("failed to init testIsUserInRole(), " + sex, false);
         }
 
-//DST        try
-//        {
-//            boolean isUserInRole = rms.isUserInRole("anonuser4", "testuserrolemapping");
-//            assertTrue("anonuser4 should be in role testuserrolemapping", isUserInRole);
-//        }
-//        catch (SecurityException sex)
-//        {
-//            assertTrue("user and role exist. should not have thrown an exception: " + sex,
false);
-//        }
+        try
+        {
+            boolean isUserInRole = rms.isUserInRole("anonuser4", "testuserrolemapping");
+            assertTrue("anonuser4 should be in role testuserrolemapping", isUserInRole);
+        }
+        catch (SecurityException sex)
+        {
+            assertTrue("user and role exist. should not have thrown an exception: " + sex,
false);
+        }
     }
 
     /**
@@ -296,15 +296,15 @@
         {
             assertTrue("failed to init testIsGroupInRole(), " + sex, false);
         }
-//DST        try
-//        {
-//            boolean isGroupInRole = rms.isGroupInRole("testrolegroupmapping", "testuserrolemapping");
-//            assertTrue("testrolegroupmapping should be in role testuserrolemapping", isGroupInRole);
-//        }
-//        catch (SecurityException sex)
-//        {
-//            assertTrue("group and role exist. should not have thrown an exception: " +
sex, false);
-//        }
+        try
+        {
+            boolean isGroupInRole = rms.isGroupInRole("testrolegroupmapping", "testuserrolemapping");
+            assertTrue("testrolegroupmapping should be in role testuserrolemapping", isGroupInRole);
+        }
+        catch (SecurityException sex)
+        {
+            assertTrue("group and role exist. should not have thrown an exception: " + sex,
false);
+        }
     }
 
     /**



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