Module: MIT::LDAP

Defined in:
lib/mit/ldap.rb,
lib/mit/ldap/version.rb

Constant Summary collapse

VERSION =
"0.3.4"

Class Method Summary collapse

Class Method Details

.connect!Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mit/ldap.rb', line 5

def connect!
  if MIT.on_campus?
    include Ldaptic::Module(
      :adapter => :ldap_conn,
      :connection => ::LDAP::Conn.new('ldap-too.mit.edu'),
      :host => 'ldap-too.mit.edu',
      :base => 'dc=mit,dc=edu'
    )
  end
  return connected?
end

.connected?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/mit/ldap.rb', line 17

def connected?
  !connection.nil?
end

.reconnect!Object



21
22
23
24
25
26
27
# File 'lib/mit/ldap.rb', line 21

def reconnect!
  if adapter_present?
    adapter.instance_variable_set(:@connection, ::LDAP::Conn.new('ldap-too.mit.edu'))
  elsif !adapter_present?
    connect!
  end
end