Class: AD::RecordFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/ad/record_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection = AD::ConnectionFactory.service_user_connection) ⇒ RecordFinder

Returns a new instance of RecordFinder.



5
6
7
# File 'lib/ad/record_finder.rb', line 5

def initialize(connection = AD::ConnectionFactory.service_user_connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



9
10
11
# File 'lib/ad/record_finder.rb', line 9

def connection
  @connection
end

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/ad/record_finder.rb', line 9

def result
  @result
end

Instance Method Details

#find_by_id(query, attributes: []) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/ad/record_finder.rb', line 11

def find_by_id(query, attributes: [])
  @result = @connection.search(
    base: AD.base_dn,
    filter: Net::LDAP::Filter.eq(AD.unique_id_attr, query.to_s),
    attributes: attributes
  )
end