directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1127572 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/ core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/ core/src/main/java/org/apache/directory/server/core/a...
Date Wed, 25 May 2011 16:02:20 GMT
Author: elecharny
Date: Wed May 25 16:02:19 2011
New Revision: 1127572

URL: http://svn.apache.org/viewvc?rev=1127572&view=rev
Log:
o Fixed the lookup operation when providing some attributes or the '+' special attribute
o Handled attribute removal for BtreePartition.lookup() using the OpAttr and UserAttr special
attributes
o Reestablished an @Ignored test

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=1127572&r1=1127571&r2=1127572&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Wed May 25 16:02:19 2011
@@ -594,7 +594,7 @@ public class InterceptorChain
         // trouble reading the entry due to insufficient access rights
         CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
 
-        Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES_ARRAY
);
+        Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES,
SchemaConstants.ALL_USER_ATTRIBUTES );
 
         if ( foundEntry != null )
         {

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=1127572&r1=1127571&r2=1127572&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
Wed May 25 16:02:19 2011
@@ -37,7 +37,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -100,13 +99,12 @@ public class LookupIT extends AbstractLd
      * Test a lookup( Dn, "+") operation
      */
     @Test
-    @Ignore( "The '+' special attribute is not correctly handled." )
     public void testLookupPlus() throws Exception
     {
         getService().setDenormalizeOpAttrsEnabled( true );
         Entry entry = connection.lookup( "cn=test,ou=system", "+" );
         assertNotNull( entry );
-
+        
         // We should have 4 attributes
         assertEquals( 4, entry.size() );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=1127572&r1=1127571&r2=1127572&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Wed May 25 16:02:19 2011
@@ -51,8 +51,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -265,7 +265,7 @@ public class SimpleAuthenticator extends
             LookupOperationContext lookupContext = new LookupOperationContext( getDirectoryService().getAdminSession(),
                 bindContext.getDn() );
             lookupContext.setByPassed( USERLOOKUP_BYPASS );
-            lookupContext.setAttrsId( new String[]{ "+" } );
+            lookupContext.setAttrsId( SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
 
             userEntry = getDirectoryService().getOperationManager().lookup( lookupContext
);
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=1127572&r1=1127571&r2=1127572&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
Wed May 25 16:02:19 2011
@@ -57,6 +57,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.UsageEnum;
 
 
 /**
@@ -302,16 +303,29 @@ public abstract class BTreePartition<ID>
             return entry;
         }
 
-        if ( ( lookupContext.getAttrsId() == null ) || ( lookupContext.getAttrsId().size()
== 0 ) )
+        if ( ( lookupContext.getAttrsId() == null ) || ( lookupContext.getAttrsId().size()
== 0 ) 
+            && !lookupContext.hasAllOperational() && !lookupContext.hasAllUser()
)
         {
             return entry;
         }
 
         for ( AttributeType attributeType : ( entry.getOriginalEntry() ).getAttributeTypes()
)
         {
-            if ( !lookupContext.getAttrsId().contains( attributeType.getOid() ) )
+            String oid = attributeType.getOid();
+            
+            if ( !lookupContext.getAttrsId().contains( oid ) )
             {
-                entry.removeAttributes( attributeType );
+                if ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) 
+                {
+                    if ( !lookupContext.hasAllUser() )
+                    {
+                        entry.removeAttributes( attributeType );
+                    }
+                }
+                else if ( ( !lookupContext.hasAllOperational() ) )
+                {
+                    entry.removeAttributes( attributeType );
+                }
             }
         }
 



Mime
View raw message