I am new to ldap. How do I add a user to a particular group in ldap? I am using IBM ldap and my admin had created several groups to which I need to add users programatically. Can any one tell me how to do this? Thanks!
Do you have access to the SecureWay client? If not, you will need access to either this or another LDAP client. You could do it using JNDI, but the client is generally easier. You also need to know the name of the LDAP role and the DN (ie full distinctive name) of the person you want to add to the role. Connect to the client, find the role, add the entry. If you don't have the full DN for the role, you can seach using cn=name_of_role and still able to add the user. You can find the DN of the user in the same way. This is sometimes confusing, since you add users to the role entry, rather than adding the role entry to the user. But that's the way it works. Hope this helps. Dave.
Oops, my bad, I missed the past "add users programatically". The code I use is listed below
Note that the group type we use is objecttype=groupofnames, which stores users as "member" (see the ModificationItem). If you use a different objecttype you will need to add the correct attribute. For no extra cost, here is the remove code: