directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1506571 - /directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
Date Wed, 24 Jul 2013 14:16:59 GMT
Author: kayyagari
Date: Wed Jul 24 14:16:58 2013
New Revision: 1506571

URL: http://svn.apache.org/r1506571
Log:
consider the scope before evaluating the filter (DIRSERVER-1874)

Modified:
    directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java

Modified: directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=1506571&r1=1506570&r2=1506571&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
Wed Jul 24 14:16:58 2013
@@ -20,6 +20,10 @@
 package org.apache.directory.server.core.event;
 
 
+import static org.apache.directory.api.ldap.model.message.SearchScope.OBJECT;
+import static org.apache.directory.api.ldap.model.message.SearchScope.ONELEVEL;
+import static org.apache.directory.api.ldap.model.message.SearchScope.SUBTREE;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -31,6 +35,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
@@ -54,7 +59,6 @@ import org.apache.directory.server.core.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * An {@link org.apache.directory.server.core.api.interceptor.Interceptor} based service
for notifying {@link
  * DirectoryListener}s of changes to the DIT.
@@ -406,9 +410,25 @@ public class EventInterceptor extends Ba
 
             Dn base = criteria.getBase();
 
+            SearchScope scope = criteria.getScope();
+            
+            boolean inscope = false;
+            
             // fix for DIRSERVER-1502
-            if ( ( name.equals( base ) || name.isDescendantOf( base ) )
-                && evaluator.evaluate( criteria.getFilter(), base, entry ) )
+            if ( ( scope == OBJECT ) && name.equals( base ) )
+            {
+                inscope = true;
+            }
+            else if ( ( scope == ONELEVEL ) && name.getParent().equals( base ) )
+            {
+                inscope = true;
+            }
+            else if ( ( scope == SUBTREE ) && ( name.isDescendantOf( base ) || name.equals(
base ) ) )
+            {
+                inscope = true;
+            } 
+            
+            if ( inscope && evaluator.evaluate( criteria.getFilter(), base, entry
) )
             {
                 selecting.add( registration );
             }



Mime
View raw message