Method: Net::LDAP#get_operation_result
- Defined in:
- lib/net/ldap.rb
#get_operation_result ⇒ Object
Returns a meaningful result any time after a protocol operation (#bind, #search, #add, #modify, #rename, #delete) has completed. It returns an #OpenStruct containing an LDAP result code (0 means success), and a human-readable string.
unless ldap.bind
puts "Result: #{ldap.get_operation_result.code}"
puts "Message: #{ldap.get_operation_result.}"
end
Certain operations return additional information, accessible through members of the object returned from #get_operation_result. Check #get_operation_result.error_message and #get_operation_result.matched_dn.
– Modified the implementation, 20Mar07. We might get a hash of LDAP response codes instead of a simple numeric code. ++
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
# File 'lib/net/ldap.rb', line 668 def get_operation_result result = @result os = OpenStruct.new if result.is_a?(Net::LDAP::PDU) os.extended_response = result.extended_response result = result.result end if result.is_a?(Hash) # We might get a hash of LDAP response codes instead of a simple # numeric code. os.code = (result[:resultCode] || "").to_i os. = result[:errorMessage] os.matched_dn = result[:matchedDN] elsif result os.code = result else os.code = Net::LDAP::ResultCodeSuccess end os. = Net::LDAP.result2string(os.code) os end |