Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D19DF4283 for ; Wed, 25 May 2011 16:02:41 +0000 (UTC) Received: (qmail 73169 invoked by uid 500); 25 May 2011 16:02:41 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 73125 invoked by uid 500); 25 May 2011 16:02:41 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 73113 invoked by uid 99); 25 May 2011 16:02:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 May 2011 16:02:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 May 2011 16:02:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E81F2388906; Wed, 25 May 2011 16:02:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110525160220.3E81F2388906@eris.apache.org> 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 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 ); + } } }