Active directory 如何从超过>;的大型ldap广告组中删除成员;1500名成员

Active directory 如何从超过>;的大型ldap广告组中删除成员;1500名成员,active-directory,spring-ldap,Active Directory,Spring Ldap,我正在尝试从大型ldap Active Directory(AD)组中删除成员。如果组较小,下面的代码将删除该成员。但是,如果它更大,它将无法工作,因为AD将成员拆分为多个与范围相关的属性 group.removeMember(person.getFullDn()); ldapTemplate.update(group); 我已经尝试使用下面的方法直接访问这些属性。IncrementAlatAttributesMapper允许我获取与范围相关的成员属性列表,即成员;范围=0-1499,我尝试从

我正在尝试从大型ldap Active Directory(AD)组中删除成员。如果组较小,下面的代码将删除该成员。但是,如果它更大,它将无法工作,因为AD将成员拆分为多个与范围相关的属性

group.removeMember(person.getFullDn());
ldapTemplate.update(group);
我已经尝试使用下面的方法直接访问这些属性。IncrementAlatAttributesMapper允许我获取与范围相关的成员属性列表,即成员;范围=0-1499,我尝试从每个人中删除此人,但没有效果。我没有收到错误,但该人员也没有从组中删除

DirContextOperations ctx = ldapTemplate.lookupContext(group.getDn());

    IncrementalAttributesMapper<?> attributesMapper = new DefaultIncrementalAttributesMapper("member");
        while (attributesMapper.hasMore()) {

            String[] attributes = attributesMapper.getAttributesForLookup();

            for (String attribute: attributes ) {
                 ldapTemplate.lookup(group.getDn(), attributesMapper.getAttributesForLookup(), attributesMapper);
                    ctx.removeAttributeValue(attribute, person.getDn() );   
                    ldapTemplate.modifyAttributes(ctx);
            }    
        }
DirContextOperations ctx=ldapTemplate.lookupContext(group.getDn());
IncrementalAttributesMapper attributesMapper=新的默认IncrementalAttributesMapper(“成员”);
while(attributesMapper.hasMore()){
String[]attributes=attributesMapper.getAttributesForLookup();
for(字符串属性:属性){
ldapTemplate.lookup(group.getDn(),attributesMapper.getAttributesForLookup(),attributesMapper);
removeAttributeValue(属性,person.getDn());
ldapTemplate.modifyAttributes(ctx);
}    
}
希望有人在这方面取得了更大的成功。提前谢谢

我找到了解决办法

在我刚刚意识到BasicAttribute需要字符串参数之前,我遇到了一个格式错误的属性错误。我错误地向它传递了一个Name对象

ldapTemplate.modifyAttributes(group.getDn(), new ModificationItem[] {
            new ModificationItem(
                DirContext.REMOVE_ATTRIBUTE,
                new BasicAttribute("member", person.getFullDn().toString() ))
        });