PDA

View Full Version : new uniqueMember in Ldap group


sobychacko
Aug 7th, 2006, 12:11 PM
Hi all,

I am trying to add a new entry in my existing ldap group (a new uniqueMember). However, when I am trying to add a new uniqueMember through ldapTemplate, I am not able to do that. It complains that this attribute already exists. Can anyone please explain how I can do that through ldapTemplate? Below is what I used to create my initial members:

dn: cn=poweruser,ou=groups,dc=ui,dc=mydomain,dc=com
objectClass: groupOfUniqueNames
cn: poweruser
uniqueMember: uid=user1,ou=users,dc=ui,dc=mydomain,dc=com
uniqueMember: uid=user2,ou=users,dc=ui,dc=mydomain,dc=com

and I am trying to simply add a new uniqueMember through LdapTemplate.
I will greatly appreciate if anybody can help...

Thank you,
Soby Chacko

rasky
Aug 7th, 2006, 12:58 PM
You should be able to use the modifyAttributes method, e.g.:

ModificationItem[] mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("uniqueMember", <dn to add>));
ldapTemplate.modifyAttributes("cn=poweruser,ou=groups,dc=ui,dc=mydomain,dc=com",mods);

sobychacko
Aug 7th, 2006, 02:19 PM
Thanks a lot. It works fine now.

Soby