mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
cleanup: rubocop: fix Layout/MultilineHashBraceLayout and Layout/SpaceInsideBlockBraces in app/models/auth_source_ldap.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19293 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0c341eb21d
commit
bfeffd964b
@ -179,7 +179,6 @@ Layout/MultilineArrayBraceLayout:
|
|||||||
Layout/MultilineHashBraceLayout:
|
Layout/MultilineHashBraceLayout:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/context_menus_controller.rb'
|
- 'app/controllers/context_menus_controller.rb'
|
||||||
- 'app/models/auth_source_ldap.rb'
|
|
||||||
- 'lib/redmine/access_keys.rb'
|
- 'lib/redmine/access_keys.rb'
|
||||||
- 'lib/redmine/helpers/time_report.rb'
|
- 'lib/redmine/helpers/time_report.rb'
|
||||||
- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
|
- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
|
||||||
|
|||||||
@ -71,7 +71,6 @@ class AuthSourceLdap < AuthSource
|
|||||||
with_timeout do
|
with_timeout do
|
||||||
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||||||
ldap_con.open {}
|
ldap_con.open {}
|
||||||
|
|
||||||
if self.account.present? && !self.account.include?("$login") && self.account_password.present?
|
if self.account.present? && !self.account.include?("$login") && self.account_password.present?
|
||||||
ldap_auth = authenticate_dn(self.account, self.account_password)
|
ldap_auth = authenticate_dn(self.account, self.account_password)
|
||||||
raise AuthSourceException.new(l(:error_ldap_bind_credentials)) if !ldap_auth
|
raise AuthSourceException.new(l(:error_ldap_bind_credentials)) if !ldap_auth
|
||||||
@ -177,9 +176,7 @@ class AuthSourceLdap < AuthSource
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize_ldap_con(ldap_user, ldap_password)
|
def initialize_ldap_con(ldap_user, ldap_password)
|
||||||
options = { :host => self.host,
|
options = {:host => self.host, :port => self.port}
|
||||||
:port => self.port
|
|
||||||
}
|
|
||||||
if tls
|
if tls
|
||||||
options[:encryption] = {
|
options[:encryption] = {
|
||||||
:method => :simple_tls,
|
:method => :simple_tls,
|
||||||
@ -189,8 +186,9 @@ class AuthSourceLdap < AuthSource
|
|||||||
:tls_options => {:verify_mode => verify_peer? ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE}
|
:tls_options => {:verify_mode => verify_peer? ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
unless ldap_user.blank? && ldap_password.blank?
|
||||||
options.merge!(:auth => { :method => :simple, :username => ldap_user, :password => ldap_password }) unless ldap_user.blank? && ldap_password.blank?
|
options.merge!(:auth => {:method => :simple, :username => ldap_user, :password => ldap_password})
|
||||||
|
end
|
||||||
Net::LDAP.new options
|
Net::LDAP.new options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user