Class: LDAP::Conn
- Inherits:
-
Object
- Object
- LDAP::Conn
- Defined in:
- lib/active_ldap/adapter/ldap_ext.rb
Instance Method Summary collapse
- #assert_error_code ⇒ Object
- #error_code ⇒ Object
- #error_message ⇒ Object
- #failed? ⇒ Boolean
- #search_with_limit(base, scope, filter, attributes, limit, &block) ⇒ Object
Instance Method Details
#assert_error_code ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 92 def assert_error_code return unless failed? code = error_code = klass = ActiveLdap::LdapError::ERRORS[code] klass ||= IMPLEMENT_SPECIFIC_ERRORS[code] if klass.nil? and == "Can't contact LDAP server" klass = ActiveLdap::ConnectionError end klass ||= ActiveLdap::LdapError raise klass, end |
#error_code ⇒ Object
78 79 80 81 82 |
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 78 def error_code code = err code = get_option(LDAP_OPT_ERROR_NUMBER) if code.zero? code end |
#error_message ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 84 def if failed? LDAP.err2string(error_code) else nil end end |
#failed? ⇒ Boolean
74 75 76 |
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 74 def failed? not error_code.zero? end |
#search_with_limit(base, scope, filter, attributes, limit, &block) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 60 def search_with_limit(base, scope, filter, attributes, limit, &block) if @@have_search_ext search_ext(base, scope, filter, attributes, false, nil, nil, 0, 0, limit || 0, &block) else i = 0 search(base, scope, filter, attributes) do |entry| i += 1 block.call(entry) break if limit and limit <= i end end end |