Class: Net::LDAP::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/ldaptic/adapters/net_ldap_ext.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#rename(args) ⇒ Object

Monkey-patched in support for new superior.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ldaptic/adapters/net_ldap_ext.rb', line 7

def rename args
  old_dn = args[:olddn] or raise "Unable to rename empty DN"
  new_rdn = args[:newrdn] or raise "Unable to rename to empty RDN"
  new_superior = args[:newsuperior]
  delete_attrs = args[:delete_attributes] ? true : false

  request = [old_dn.to_ber, new_rdn.to_ber, delete_attrs.to_ber]
  request << new_superior.to_ber(128) if new_superior
  request = request.to_ber_appsequence(12)
  pkt = [next_msgid.to_ber, request].to_ber_sequence
  @conn.write pkt

  (be = @conn.read_ber(AsnSyntax)) && (pdu = Net::LdapPdu.new( be )) && (pdu.app_tag == 13) or raise LdapError.new( "response missing or invalid" )
  pdu.result_code
end