Method: Net::LDAP#delete

Defined in:
lib/net/ldap.rb

#delete(args) ⇒ Object

Delete an entry from the LDAP directory. Takes a hash of arguments. The only supported argument is :dn, which must give the complete DN of the entry to be deleted. Returns True or False to indicate whether the delete succeeded. Extended status information is available by calling #get_operation_result.

dn = "mail=deleteme@example.com,ou=people,dc=example,dc=com"
ldap.delete :dn => dn
[View source]

989
990
991
992
993
994
995
996
997
998
999
1000
1001
# File 'lib/net/ldap.rb', line 989

def delete args
  if @open_connection
      @result = @open_connection.delete( args )
  else
    @result = 0
    conn = Connection.new( :host => @host, :port => @port, :encryption => @encryption )
    if (@result = conn.bind( args[:auth] || @auth )) == 0
      @result = conn.delete( args )
    end
    conn.close
  end
  @result == 0
end