Announcement Announcement Module
Collapse
No announcement yet.
Remove users from a group with more than 1500 members Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Remove users from a group with more than 1500 members

    Hi!

    I have an Active Directory group with more than 1500 members (~3500). My problem is that when I call removeAttributeValue on DirContextOperations no exception is thrown, but nothing happens. The user still remains member of the group. The code works perfectly with groups less than 1500 members.

    Code:
    DirContextOperations context = ldapTemplate.lookupContext(groupDn);
    context.removeAttributeValue("member", personDn);
    ldapTemplate.modifyAttributes(context);
    I know that there are restrictions on multi-valued attributes in AD. I have found sample codes with wich I can query the members of the given group using range option. But I can't find any solution removing users from a group like this.

    Any help would be appreciated!!
    Last edited by dakrul; Feb 23rd, 2012, 04:18 AM.

  • #2
    I've found the solution. It's very simple. One have to use ModificationItems instead of removeAttributeValue().
    I think someone at springsource should consider registering this as a bug.

    So here is the solution:
    Code:
    ldapTemplate.modifyAttributes(groupDn, new ModificationItem[] {
    	new ModificationItem(
    		DirContext.REMOVE_ATTRIBUTE,
    		new BasicAttribute("member", personDn))
    });

    Comment

    Working...
    X