ldap그룹 정보의 uniquemember 삭제 .
netscape와 java api를 이용한 방법.
// netscape api 이용.
public void testRemoveUniqueMember() throws NamingException {
LDAPConnection ldapCon = getLdapConnection();
boolean flag = false;
String uniqueUserDn= "uid=123,cn=11,cn=users,dc=test,dc=co,dc=kr";
String dn = "cn=11,cn=groups,dc=test,dc=co,dc=kr";
try {
LDAPModificationSet mods = new LDAPModificationSet();
LDAPAttribute attr = new LDAPAttribute("uniquemember", fullDn);
mods.add(LDAPModification.DELETE, attr);
ldapCon.modify(dn, mods);
flag = true;
} catch (LDAPException e) {
e.printStackTrace();
}
}
// java api이용
public void testRemoveUniqueMember() throws NamingException {
DirContext ctx = null;
ctx = getLdapConnection(); // ldap 접속
ModificationItem[] modificationItems = new ModificationItem[1];
String dn= "uid=123,cn=11,cn=users,dc=test,dc=co,dc=kr";
String uniqueUserDn= "cn=11,cn=groups,dc=test,dc=co,dc=kr"
modificationItems = new ModificationItem[1];
modificationItems[0] = new ModificationItem(ctx.REMOVE_ATTRIBUTE, new BasicAttribute("uniqueMember", uniqueUserDn));
ctx.modifyAttributes(dn, modificationItems);
}