Active Directory LDAP将用户移动到不同的OU – Ruby

我在与Active Directory的集成方面遇到了麻烦。 我需要能够将用户从一个OU移动到另一个OU。 我正在使用net-ldap 0.5.0,它位于github master分支上,并在源代码中挖出来,发现你可以做到这一点

$ldap.rename( olddn: "cn=bradford ricechip,ou=agents,ou=ihs,ou=test environment,dc=ctatechs,dc=com", newrdn: "cn=bradford ricechip", new_superior: "ou=coach,ou=ihs,ou=test environment,dc=ctatechs,dc=com" ) 

我得到: # 。 我想我不明白如何删除旧的RDN然后将用户移动到新的OU。

这是我唯一的问题。 如果我需要提供任何其他信息,请告诉我。 在此先感谢您的帮助!

这就是我们解决它的方式:

 @ldap.rename( olddn: user.dn, newrdn: "CN=#{user.cn}", delete_attributes: true, new_superior: "#{new_ou}" ) 

我们还在Github上使用了ldap-ruby的版本而不是RubyGems上的版本。