directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r326517 - in /directory/shared/ldap/trunk/common/src: antlr/ACIItem.g test/org/apache/ldap/common/aci/ACIItemParserTest.java
Date Wed, 19 Oct 2005 10:16:23 GMT
Author: ersiner
Date: Wed Oct 19 03:16:08 2005
New Revision: 326517

URL: http://svn.apache.org/viewcvs?rev=326517&view=rev
Log:
changes...:
 - Updated ACIItem grammar so that it does not require ProtectedItems and UserClasses to be
in a specific order.

to do...:
 - Need to check component duplication
 - May need to extend this flexibility for more components

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

Modified: directory/shared/ldap/trunk/common/src/antlr/ACIItem.g
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/antlr/ACIItem.g?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/antlr/ACIItem.g (original)
+++ directory/shared/ldap/trunk/common/src/antlr/ACIItem.g Wed Oct 19 03:16:08 2005
@@ -339,196 +339,30 @@
     ID_protectedItems ( SP )*
         OPEN_CURLY ( SP )*
             (
-                ( entry ( SP )* entry_follower
-                | allUserAttributeTypes ( SP )* allUserAttributeTypes_follower
-                | attributeType ( SP )* attributeType_follower
-                | allAttributeValues ( SP )* allAttributeValues_follower 
-                | allUserAttributeTypesAndValues ( SP )* allUserAttributeTypesAndValues_follower
-                | attributeValue ( SP )* attributeValue_follower
-                | selfValue ( SP )* selfValue_follower
-                | rangeOfValues ( SP )* rangeOfValues_follower
-                | maxValueCount ( SP )* maxValueCount_follower
-                | maxImmSub ( SP )* maxImmSub_follower
-                | restrictedBy ( SP )* restrictedBy_follower
-                | classes ( SP )*
-                )
+                //TODO: Add duplication checks
+                protectedItem ( SP )*
+                    ( SEP ( SP )* protectedItem ( SP )* )*
             )?
         CLOSE_CURLY
     ;
 
-entry_follower
+protectedItem
 {
-    log.debug( "entered entry_follower()" );
+    log.debug( "entered protectedItem()" );
 }
     :
-    ( SEP ( SP )*
-        ( allUserAttributeTypes ( SP )* allUserAttributeTypes_follower
-        | attributeType ( SP )* attributeType_follower
-        | allAttributeValues ( SP )* allAttributeValues_follower
-        | allUserAttributeTypesAndValues ( SP )* allUserAttributeTypesAndValues_follower
-        | attributeValue ( SP )* attributeValue_follower
-        | selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-allUserAttributeTypes_follower
-{
-    log.debug( "entered allUserAttributeTypes_follower()" );
-}
-    :
-    ( SEP ( SP )* 
-        ( attributeType ( SP )* attributeType_follower
-        | allAttributeValues ( SP )* allAttributeValues_follower
-        | allUserAttributeTypesAndValues ( SP )* allUserAttributeTypesAndValues_follower
-        | attributeValue ( SP )* attributeValue_follower
-        | selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-attributeType_follower
-{
-    log.debug( "entered attributeType_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( allAttributeValues ( SP )* allAttributeValues_follower
-        | allUserAttributeTypesAndValues ( SP )* allUserAttributeTypesAndValues_follower
-        | attributeValue ( SP )* attributeValue_follower
-        | selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-allAttributeValues_follower
-{
-    log.debug( "entered allAttributeValues_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( allUserAttributeTypesAndValues ( SP )* allUserAttributeTypesAndValues_follower
-        | attributeValue ( SP )* attributeValue_follower
-        | selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-allUserAttributeTypesAndValues_follower
-{
-    log.debug( "entered allUserAttributeTypesAndValues_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( attributeValue ( SP )* attributeValue_follower
-        | selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-attributeValue_follower
-{
-    log.debug( "entered attributeValue_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( selfValue ( SP )* selfValue_follower
-        | rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-selfValue_follower
-{
-    log.debug( "entered selfValue_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( rangeOfValues ( SP )* rangeOfValues_follower
-        | maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-rangeOfValues_follower
-{
-    log.debug( "entered rangeOfValues_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( maxValueCount ( SP )* maxValueCount_follower
-        | maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-maxValueCount_follower
-{
-    log.debug( "entered maxValueCount_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( maxImmSub ( SP )* maxImmSub_follower
-        | restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-maxImmSub_follower
-{
-    log.debug( "entered maxImmSub_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( restrictedBy ( SP )* restrictedBy_follower
-        | classes ( SP )*
-        )
-    )?
-    ;
-
-restrictedBy_follower
-{
-    log.debug( "entered restrictedBy_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        classes ( SP )*
-    )?
+    entry
+    | allUserAttributeTypes
+    | attributeType
+    | allAttributeValues 
+    | allUserAttributeTypesAndValues
+    | attributeValue
+    | selfValue
+    | rangeOfValues
+    | maxValueCount
+    | maxImmSub
+    | restrictedBy
+    | classes
     ;
 
 entry
@@ -894,64 +728,23 @@
     ID_userClasses ( SP )+
     OPEN_CURLY ( SP )*
         (
-            ( allUsers ( SP )* allUsers_follower
-            | thisEntry ( SP )* thisEntry_follower
-            | name ( SP )* name_follower
-            | userGroup ( SP )* userGroup_follower
-            | subtree ( SP )*
-            )
-
+            //TODO: Add duplication checks
+            userClass ( SP )*
+                ( SEP ( SP )* userClass ( SP )* )*
         )?
     CLOSE_CURLY
     ;
 
-allUsers_follower
-{
-    log.debug( "entered allUsers_follower()" );
-}
-    :
-    ( SEP ( SP )*
-         ( thisEntry ( SP )* thisEntry_follower
-         | name ( SP )* name_follower
-         | userGroup ( SP )* userGroup_follower
-         | subtree ( SP )*
-         )
-    )?
-    ;
-
-thisEntry_follower
+userClass
 {
-    log.debug( "entered thisEntry_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( name ( SP )* name_follower
-        | userGroup ( SP )* userGroup_follower
-        | subtree ( SP )*
-        )
-    )?
-    ;
-
-name_follower
-{
-    log.debug( "entered name_follower()" );
-}
-    :
-    ( SEP ( SP )*
-        ( userGroup ( SP )* userGroup_follower
-        | subtree ( SP )*
-        )
-    )?
-    ;
-
-userGroup_follower
-{
-    log.debug( "entered userGroup_follower()" );
+    log.debug( "entered userClasses()" );
 }
     :
-    ( SEP ( SP )*
-        subtree ( SP )*
-    )?
+    allUsers
+    | thisEntry 
+    | name
+    | userGroup
+    | subtree
     ;
 
 allUsers

Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/aci/ACIItemParserTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/aci/ACIItemParserTest.java?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/aci/ACIItemParserTest.java
(original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/aci/ACIItemParserTest.java
Wed Oct 19 03:16:08 2005
@@ -119,4 +119,35 @@
                 "grantsAndDenials { grantAdd } } } } }";
         parser.parse( spec );
     }
+    
+    
+    public void testItemFirstOrderOfProtectedItemsDoesNotMatter() throws Exception
+    {
+        String spec = " {  identificationTag  \"id1\" , precedence 114  , authenticationLevel
simple  , " +
+        "itemOrUserFirst itemFirst  :{ protectedItems  { attributeType { 1.2.3    , ou },
entry , " +
+        " rangeOfValues (cn=ErsinEr) , attributeValue { ou=people  , cn=Ersin  }," +
+        "classes and : { item: xyz , or:{item:X,item:Y}   }}  , " +
+        "itemPermissions { { userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\"
} " +
+        " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare  ,
grantModify } }," +
+        "{ precedence 10, userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\"
} " +
+        " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare  ,
grantModify } } } }}";
+        
+        /*ACIItem l_ACIItem = */parser.parse(spec);
+        
+        // System.out.println( l_ACIItem );
+    }
+    
+    public void testUserFirstOrderOfUserClassesDoesNotMatter() throws Exception
+    {
+        String spec = "{ identificationTag \"id2\"   , precedence 14, authenticationLevel
none  , " +
+        "itemOrUserFirst userFirst:  { userClasses {  name { \"ou=people,cn=ersin\" }, allUsers,
" +
+        "subtree {{ base \"ou=system\", specificationFilter and:{ } }, { base \"ou=ORGANIZATIONUNIT\","
+
+        "minimum  1, maximum   2 } } }  , " +
+        "userPermissions { { protectedItems{ entry  , attributeType { cn  , ou }  , attributeValue
{x=y,m=n,k=l} , " +
+        "rangeOfValues (cn=ErsinEr) }  , grantsAndDenials { grantBrowse } } } }  }   ";
+        
+        /*ACIItem l_ACIItem = */parser.parse(spec);
+        
+        // System.out.println( l_ACIItem );
+    }
 }



Mime
View raw message