Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 72924 invoked from network); 7 Sep 2005 13:44:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Sep 2005 13:44:23 -0000 Received: (qmail 80097 invoked by uid 500); 7 Sep 2005 13:44:23 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 80067 invoked by uid 500); 7 Sep 2005 13:44:22 -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 80054 invoked by uid 99); 7 Sep 2005 13:44:22 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2005 06:44:22 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 07 Sep 2005 06:44:35 -0700 Received: (qmail 72888 invoked by uid 65534); 7 Sep 2005 13:44:21 -0000 Message-ID: <20050907134421.72887.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r279323 - /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java Date: Wed, 07 Sep 2005 13:44:20 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: akarasulu Date: Wed Sep 7 06:44:16 2005 New Revision: 279323 URL: http://svn.apache.org/viewcvs?rev=279323&view=rev Log: fixing a couple bugs with move operations and added entry addition handling Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java?rev=279323&r1=279322&r2=279323&view=diff ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/subtree/SubentryService.java Wed Sep 7 06:44:16 2005 @@ -34,6 +34,7 @@ import org.apache.ldap.common.subtree.SubtreeSpecificationParser; import org.apache.ldap.common.subtree.SubtreeSpecification; import org.apache.ldap.common.name.DnParser; +import org.apache.ldap.common.name.LdapName; import org.apache.ldap.common.exception.LdapNoSuchAttributeException; import org.apache.ldap.common.exception.LdapInvalidAttributeValueException; import org.slf4j.Logger; @@ -333,6 +334,92 @@ } else { + Iterator list = subtrees.keySet().iterator(); + while ( list.hasNext() ) + { + String subentryDnStr = ( String ) list.next(); + Name subentryDn = new LdapName( subentryDnStr ); + Name apDn = ( Name ) subentryDn.clone(); + apDn.remove( apDn.size() - 1 ); + SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn ); + + if ( evaluator.evaluate( ss, apDn, subentryDn, objectClasses ) ) + { + Attribute administrativeRole = nexus.lookup( apDn ).get( "administrativeRole" ); + NamingEnumeration roles = administrativeRole.getAll(); + while ( roles.hasMore() ) + { + Attribute operational = null; + String role = ( String ) roles.next(); + + if ( role.equalsIgnoreCase( AUTONOUMOUS_AREA ) ) + { + operational = entry.get( AUTONOUMOUS_AREA_SUBENTRY ); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AUTONOUMOUS_AREA_SUBENTRY ); + entry.put( operational ); + } + } + else if ( role.equalsIgnoreCase( AC_AREA ) ) + { + operational = ( Attribute ) entry.get( AC_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AC_AREA_SUBENTRY ); + entry.put( operational ); + } + } + else if ( role.equalsIgnoreCase( AC_INNERAREA ) ) + { + operational = ( Attribute ) entry.get( AC_INNERAREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AC_INNERAREA_SUBENTRY ); + entry.put( operational ); + } + } + else if ( role.equalsIgnoreCase( SCHEMA_AREA ) ) + { + operational = ( Attribute ) entry.get( SCHEMA_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( SCHEMA_AREA_SUBENTRY ); + entry.put( operational ); + } + } + else if ( role.equalsIgnoreCase( COLLECTIVE_AREA ) ) + { + operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( COLLECTIVE_AREA_SUBENTRY ); + entry.put( operational ); + } + } + else if ( role.equalsIgnoreCase( COLLECTIVE_INNERAREA ) ) + { + operational = ( Attribute ) entry.get( COLLECTIVE_INNERAREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( COLLECTIVE_INNERAREA_SUBENTRY ); + entry.put( operational ); + } + } + else + { + throw new LdapInvalidAttributeValueException( "Encountered invalid administrativeRole '" + + role + "' in administrative point of subentry " + subentryDnStr + ". The values of this attribute" + + " are constrained to autonomousArea, accessControlSpecificArea, accessControlInnerArea," + + " subschemaAdminSpecificArea, collectiveAttributeSpecificArea, and" + + " collectiveAttributeInnerArea.", ResultCodeEnum.CONSTRAINTVIOLATION ); + } + + operational.add( subentryDn.toString() ); + } + } + } + next.add( upName, normName, entry ); } } @@ -715,26 +802,86 @@ if ( role.equalsIgnoreCase( AUTONOUMOUS_AREA ) ) { operational = ( Attribute ) entry.get( AUTONOUMOUS_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AUTONOUMOUS_AREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else if ( role.equalsIgnoreCase( AC_AREA ) ) { operational = ( Attribute ) entry.get( AC_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AC_AREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else if ( role.equalsIgnoreCase( AC_INNERAREA ) ) { operational = ( Attribute ) entry.get( AC_INNERAREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( AC_INNERAREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else if ( role.equalsIgnoreCase( SCHEMA_AREA ) ) { operational = ( Attribute ) entry.get( SCHEMA_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( SCHEMA_AREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else if ( role.equalsIgnoreCase( COLLECTIVE_AREA ) ) { operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( COLLECTIVE_AREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else if ( role.equalsIgnoreCase( COLLECTIVE_INNERAREA ) ) { - operational = ( Attribute ) entry.get( COLLECTIVE_AREA_SUBENTRY ).clone(); + operational = ( Attribute ) entry.get( COLLECTIVE_INNERAREA_SUBENTRY ).clone(); + if ( operational == null ) + { + operational = new LockableAttributeImpl( COLLECTIVE_INNERAREA_SUBENTRY ); + operational.add( newName.toString() ); + } + else + { + operational.remove( oldName.toString() ); + operational.add( newName.toString() ); + } } else { @@ -743,16 +890,6 @@ + " are constrained to autonomousArea, accessControlSpecificArea, accessControlInnerArea," + " subschemaAdminSpecificArea, collectiveAttributeSpecificArea, and" + " collectiveAttributeInnerArea.", ResultCodeEnum.CONSTRAINTVIOLATION ); - } - - if ( operational == null ) - { - operational.add( newName.toString() ); - } - else - { - operational.remove( oldName.toString() ); - operational.add( newName.toString() ); } modList.add( new ModificationItem( DirContext.REPLACE_ATTRIBUTE, operational ) );