directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r730519 - in /directory/shared/trunk/ldap/src: main/antlr/ACIItem.g test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
Date Thu, 01 Jan 2009 09:50:01 GMT
Author: seelmann
Date: Thu Jan  1 01:50:01 2009
New Revision: 730519

URL: http://svn.apache.org/viewvc?rev=730519&view=rev
Log:
DIRSTUDIO-440: Reset precedence variable

Modified:
    directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java

Modified: directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/ACIItem.g?rev=730519&r1=730518&r2=730519&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/ACIItem.g Thu Jan  1 01:50:01 2009
@@ -111,7 +111,7 @@
     // these are only used by three first order components
     private String identificationTag;
     private AuthenticationLevel authenticationLevel;
-    private int aciPrecedence;
+    private int aciPrecedence = -1;
     
     private boolean isItemFirstACIItem;
     
@@ -121,7 +121,7 @@
     private Set<UserClass> userClasses;
     private Map<String, UserClass> userClassesMap;
     private Set<ItemPermission> itemPermissions;
-    private int precedence;
+    private int precedence = -1;
     private Set<GrantAndDenial> grantsAndDenials;
     private Set<UserPermission> userPermissions;
     private Map<String, OidNormalizer> oidsMap;
@@ -212,7 +212,7 @@
         {
             ACIItem = new ItemFirstACIItem(
                     identificationTag,
-                    precedence,
+                    aciPrecedence,
                     authenticationLevel,
                     protectedItems,
                     itemPermissions );
@@ -277,6 +277,7 @@
     precedence
     {
         aciPrecedence = precedence;
+        precedence = -1;
     }
     ;
 
@@ -733,6 +734,7 @@
         }
         
         itemPermission = new ItemPermission( precedence, grantsAndDenials, userClasses );
+        precedence = -1;
     }
     ;
 
@@ -1002,7 +1004,8 @@
                      + userPermissionComponentsMonitor.getRemainingComponents() );
          }
          
-         userPermission = new UserPermission( aciPrecedence, grantsAndDenials, protectedItems
);
+         userPermission = new UserPermission( precedence, grantsAndDenials, protectedItems
);
+         precedence = -1;
      }
      ;
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java?rev=730519&r1=730518&r2=730519&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ACIItemParserTest.java
Thu Jan  1 01:50:01 2009
@@ -508,8 +508,45 @@
         ACIItem item = parser.parse( spec );
         checkItemToString( spec, item );
     }
-    
-    
+
+
+    /**
+     * Test case for DIRSTUDIO-440
+     */
+    public void testPrecedenceOfUserFirst() throws Exception
+    {
+        String spec = "{ identificationTag \"test\", precedence 14, authenticationLevel simple,
"
+            + "itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { {
"
+            + "precedence 1, protectedItems { attributeType { userPassword } }, grantsAndDenials
"
+            + "{ denyRead, denyReturnDN, denyBrowse } }, { precedence 2, protectedItems "
+            + "{ entry, allUserAttributeTypesAndValues }, grantsAndDenials "
+            + "{ grantReturnDN, grantRead, grantBrowse } } } } }";
+
+        ACIItem item = parser.parse( spec );
+        checkItemToString( spec, item );
+
+        UserFirstACIItem userFirstItem = ( UserFirstACIItem ) item;
+        int aciPrecedence = userFirstItem.getPrecedence();
+        assertEquals( 14, aciPrecedence );
+        for ( UserPermission permission : userFirstItem.getUserPermission() )
+        {
+            int precedence = permission.getPrecedence();
+            if ( precedence == 1 )
+            {
+                assertEquals( 1, precedence );
+            }
+            else if ( precedence == 2 )
+            {
+                assertEquals( 2, precedence );
+            }
+            else
+            {
+                fail( "Got precedence " + precedence + ", excpected precedence 1 or 2." );
+            }
+        }
+    }
+
+
     /**
      * Test case for DIRSERVER-891
      */



Mime
View raw message