Class: ActiveLdap::Configuration::ClassMethods::URIConfigurationMerger
- Inherits:
-
Object
- Object
- ActiveLdap::Configuration::ClassMethods::URIConfigurationMerger
- Defined in:
- lib/active_ldap/configuration.rb
Instance Method Summary collapse
-
#initialize(uri) ⇒ URIConfigurationMerger
constructor
A new instance of URIConfigurationMerger.
- #merge(configuration) ⇒ Object
Constructor Details
#initialize(uri) ⇒ URIConfigurationMerger
Returns a new instance of URIConfigurationMerger.
170 171 172 |
# File 'lib/active_ldap/configuration.rb', line 170 def initialize(uri) @uri = uri end |
Instance Method Details
#merge(configuration) ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/active_ldap/configuration.rb', line 174 def merge(configuration) uri_configuration = {:port => @uri.port} uri_configuration[:host] = @uri.host if @uri.host uri_configuration[:base] = @uri.dn if @uri.dn extensions = parse_extensions bindname_extension = extensions["bindname"] if bindname_extension uri_configuration[:bind_dn] = bindname_extension[:value] uri_configuration[:allow_anonymous] = !bindname_extension[:critical] end uri_configuration[:scope] = @uri.scope if @uri.scope uri_configuration[:method] = :ssl if @uri.is_a?(URI::LDAPS) uri_configuration.merge(configuration) end |