Class: GitHub::Ldap::ReferralChaser::Referral

Inherits:
Object
  • Object
show all
Defined in:
lib/github/ldap/referral_chaser.rb

Overview

Represents a referral entry from an LDAP search result. Constructs a corresponding GitHub::Ldap object from the paramaters on the referral_url and provides a #search method to continue the search on the referred domain.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(referral_url, admin_user, admin_password, port = nil) ⇒ Referral

Returns a new instance of Referral.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/github/ldap/referral_chaser.rb', line 73

def initialize(referral_url, admin_user, admin_password, port=nil)
  url = GitHub::Ldap::URL.new(referral_url)
  @search_base = url.dn

  connection_options = {
    host: url.host,
    port: port || url.port,
    scope: url.scope,
    admin_user: admin_user,
    admin_password: admin_password
  }

  @connection = GitHub::Ldap::ConnectionCache.get_connection(connection_options)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



94
95
96
# File 'lib/github/ldap/referral_chaser.rb', line 94

def connection
  @connection
end

#search_baseObject (readonly)

Returns the value of attribute search_base.



94
95
96
# File 'lib/github/ldap/referral_chaser.rb', line 94

def search_base
  @search_base
end

Instance Method Details

#search(options) ⇒ Object

Search the referred domain controller with options, merging in the referred search base DN onto options.



90
91
92
# File 'lib/github/ldap/referral_chaser.rb', line 90

def search(options)
  connection.search(options.merge(base: search_base))
end