directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vte...@apache.org
Subject svn commit: r153976 - in incubator/directory/authx/trunk: core/impl/src/java/org/apache/authx/authentication/attribute/ script/src/java/org/apache/authx/script/ script/src/java/org/apache/authx/script/xml/ script/src/java/org/apache/authx/script/xml/builder/ script/src/test/org/apache/authx/script/xml/
Date Tue, 15 Feb 2005 23:34:57 GMT
Author: vtence
Date: Tue Feb 15 15:34:52 2005
New Revision: 153976

URL: http://svn.apache.org/viewcvs?view=rev&rev=153976
Log:
Fixed bug with Or rules in Dom4JRuleSetBuilder

Modified:
    incubator/directory/authx/trunk/core/impl/src/java/org/apache/authx/authentication/attribute/AttributeProvider.java
    incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/InformationProviderBuilder.java
    incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/AbstractDom4JInformationProviderBuilder.java
    incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/Dom4JRuleSetBuilder.java
    incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/ReverseBuildingContext.java
    incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/builder/LogicalPredicateBuilder.java
    incubator/directory/authx/trunk/script/src/test/org/apache/authx/script/xml/Dom4JRuleSetBuilderTest.java

Modified: incubator/directory/authx/trunk/core/impl/src/java/org/apache/authx/authentication/attribute/AttributeProvider.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/core/impl/src/java/org/apache/authx/authentication/attribute/AttributeProvider.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/core/impl/src/java/org/apache/authx/authentication/attribute/AttributeProvider.java
(original)
+++ incubator/directory/authx/trunk/core/impl/src/java/org/apache/authx/authentication/attribute/AttributeProvider.java
Tue Feb 15 15:34:52 2005
@@ -93,12 +93,11 @@
 
     private Collection attributes( Principal principal )
     {
-        Collection attributes = ( Collection ) m_attributes.get( principal );
-        if ( attributes == null)
-        {
-            attributes = new HashSet();
-            m_attributes.put( principal, attributes );
-        }
+        if ( m_attributes.containsKey( principal ) )
+            return ( Collection ) m_attributes.get( principal );
+
+        Collection attributes = new HashSet();
+        m_attributes.put( principal, attributes );
         return attributes;
     }
 }

Modified: incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/InformationProviderBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/InformationProviderBuilder.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/InformationProviderBuilder.java
(original)
+++ incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/InformationProviderBuilder.java
Tue Feb 15 15:34:52 2005
@@ -17,7 +17,6 @@
 package org.apache.authx.script;
 
 import org.apache.authx.authentication.attribute.MutableInformationProvider;
-import org.apache.authx.authentication.attribute.MutableInformationProvider;
 
 public interface InformationProviderBuilder
 {

Modified: incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/AbstractDom4JInformationProviderBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/AbstractDom4JInformationProviderBuilder.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/AbstractDom4JInformationProviderBuilder.java
(original)
+++ incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/AbstractDom4JInformationProviderBuilder.java
Tue Feb 15 15:34:52 2005
@@ -16,13 +16,12 @@
  */
 package org.apache.authx.script.xml;
 
-import org.apache.authx.authentication.attribute.MutableInformationProvider;
+import org.apache.authx.authentication.attribute.CyclicAssociationException;
 import org.apache.authx.authentication.attribute.GroupPrincipal;
 import org.apache.authx.authentication.attribute.MutableInformationProvider;
-import org.apache.authx.authentication.attribute.CyclicAssociationException;
 import org.apache.authx.authentication.realm.UsernamePrincipal;
-import org.apache.authx.script.InformationProviderBuilderMonitor;
 import org.apache.authx.script.InformationProviderBuilder;
+import org.apache.authx.script.InformationProviderBuilderMonitor;
 import org.dom4j.Element;
 
 import java.security.Principal;

Modified: incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/Dom4JRuleSetBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/Dom4JRuleSetBuilder.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/Dom4JRuleSetBuilder.java
(original)
+++ incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/Dom4JRuleSetBuilder.java
Tue Feb 15 15:34:52 2005
@@ -19,15 +19,15 @@
 import org.apache.authx.authorization.Rule;
 import org.apache.authx.authorization.RuleSet;
 import org.apache.authx.script.RuleSetBuilder;
-import org.apache.authx.script.xml.builder.HasUsernamePredicateBuilder;
-import org.apache.authx.script.xml.builder.TruePredicateBuilder;
+import org.apache.authx.script.xml.builder.AndPredicateBuilder;
+import org.apache.authx.script.xml.builder.DenyRuleBuilder;
 import org.apache.authx.script.xml.builder.FalsePredicateBuilder;
+import org.apache.authx.script.xml.builder.GrantRuleBuilder;
 import org.apache.authx.script.xml.builder.HasGroupPredicateBuilder;
 import org.apache.authx.script.xml.builder.HasRolePredicateBuilder;
-import org.apache.authx.script.xml.builder.AndPredicateBuilder;
+import org.apache.authx.script.xml.builder.HasUsernamePredicateBuilder;
 import org.apache.authx.script.xml.builder.OrPredicateBuilder;
-import org.apache.authx.script.xml.builder.GrantRuleBuilder;
-import org.apache.authx.script.xml.builder.DenyRuleBuilder;
+import org.apache.authx.script.xml.builder.TruePredicateBuilder;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.Element;

Modified: incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/ReverseBuildingContext.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/ReverseBuildingContext.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/ReverseBuildingContext.java
(original)
+++ incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/ReverseBuildingContext.java
Tue Feb 15 15:34:52 2005
@@ -16,12 +16,12 @@
  */
 package org.apache.authx.script.xml;
 
-import org.dom4j.Element;
 import org.apache.authx.script.ScriptInterpretationException;
 import org.apache.authx.script.xml.builder.AbstractElementBuilder;
+import org.dom4j.Element;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 public class ReverseBuildingContext extends AbstractElementBuilder
         implements BuildingContext

Modified: incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/builder/LogicalPredicateBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/builder/LogicalPredicateBuilder.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/builder/LogicalPredicateBuilder.java
(original)
+++ incubator/directory/authx/trunk/script/src/java/org/apache/authx/script/xml/builder/LogicalPredicateBuilder.java
Tue Feb 15 15:34:52 2005
@@ -16,10 +16,8 @@
  */
 package org.apache.authx.script.xml.builder;
 
-import org.dom4j.Element;
 import org.apache.authx.authorization.Predicate;
-import org.apache.authx.authorization.predicate.Predicates;
-import org.apache.authx.authorization.predicate.AndPredicate;
+import org.dom4j.Element;
 
 import java.util.Iterator;
 
@@ -39,7 +37,7 @@
 
     public Object buildFrom( Element e )
     {
-        Predicate p = Predicates.TRUE;
+        Predicate p = getSeed();
 
         for ( Iterator it = e.elementIterator(); it.hasNext(); )
         {

Modified: incubator/directory/authx/trunk/script/src/test/org/apache/authx/script/xml/Dom4JRuleSetBuilderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/authx/trunk/script/src/test/org/apache/authx/script/xml/Dom4JRuleSetBuilderTest.java?view=diff&r1=153975&r2=153976
==============================================================================
--- incubator/directory/authx/trunk/script/src/test/org/apache/authx/script/xml/Dom4JRuleSetBuilderTest.java
(original)
+++ incubator/directory/authx/trunk/script/src/test/org/apache/authx/script/xml/Dom4JRuleSetBuilderTest.java
Tue Feb 15 15:34:52 2005
@@ -197,7 +197,7 @@
         assertEquals( Effects.GRANT, policy.evaluate( Subjects.with( Roles.developer() ),
Permissions.anything() ).reduce() );
     }
 
-    public void testHasBuiltinSupportForAndOperationOnPredicates() throws Exception
+    public void testHasBuiltInSupportForAndOperationOnPredicates() throws Exception
     {
         String andPredicateCombination =
                 "<policy>\n" +
@@ -225,7 +225,7 @@
         assertEquals( Effects.GRANT, policy.evaluate( Subjects.with( Usernames.joe(), Groups.geeks(),
Roles.developer() ), Permissions.anything() ).reduce() );
     }
 
-    public void testHasBuiltinSupportForOrOperationOnPredicates() throws Exception
+    public void testHasBuiltInSupportForOrOperationOnPredicates() throws Exception
     {
         String orPredicateCombination =
                 "<policy>\n" +
@@ -234,7 +234,6 @@
                 "            <or>" +
                 "                <username>joeblow</username>\n" +
                 "                <group>geeks</group>\n" +
-                "                <role>developer</role>\n" +
                 "            </or>" +
                 "        </subjects>\n" +
                 "        <permissions>\n" +
@@ -249,7 +248,7 @@
 
         assertEquals( Effects.GRANT, policy.evaluate( Subjects.with( Usernames.joe() ), Permissions.anything()
).reduce() );
         assertEquals( Effects.GRANT, policy.evaluate( Subjects.with( Groups.geeks() ), Permissions.anything()
).reduce() );
-        assertEquals( Effects.GRANT, policy.evaluate( Subjects.with( Roles.developer() ),
Permissions.anything() ).reduce() );
+        assertEquals( Effects.NOT_APPLICABLE, policy.evaluate( Subjects.with( Roles.developer()
), Permissions.anything() ).reduce() );
     }
 
     public void testSubjectIsAnAliasForAndOperation() throws Exception



Mime
View raw message