Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: James Hunt
Support for modrdn/moddn [ reply ]  
2006-12-19 02:53
Greetings, all

First off, congrats to Francis and Austin on such an awesome (and hands-down superior) LDAP interface lib. Beats the pants off of the C-extension alternative any day :-)

I noticed in poking around the documentation that there is a function (rename, modrdn, modify_rdn) that purportedly allow you to rename an entry. The documentation is a bit sparse in the 0.0.4 release (Rename an entry on the remote DIS by changing the last RDN of its DN. Documentation stub).

I found by looking at the source that the args parameter is expected to be a hash with two or three keys, :olddn, :newrdn and (optionally) :delete_attributes.

What I can't seem to figure out is how to use rename to rename an entry. Is this supposed to be its use case?

# user.distinguishedName = 'CN=user,OU=Users,DC=example,DC=net'
#
# (Oh yeah, and assuming all the set up went ok and we are able to bind, etc.)
#
ldap.rename(
:olddn => 'CN=user,OU=Users,DC=example,DC=net',
:newrdn => 'CN=user2'
:delete_attributes => false
)

I am almost done with an Active Directory library (a rewrite to get off of the ruby/ldap C extension and onto net::ldap) and would like to provide a means of moving and renaming users. For example,

ldap.move(
:old_dn => 'CN=user,OU=Users,DC=example,DC=net',
:new_dn => 'CN=user,OU=Rubyists,OU=Users,DC=example,DC=net'
)

Any thoughts, ideas or comments?

James