]> source.dussan.org Git - redmine.git/commitdiff
cleanup: rubocop: fix Layout/MultilineHashBraceLayout and Layout/SpaceInsideBlockBrac...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 25 Nov 2019 09:08:55 +0000 (09:08 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 25 Nov 2019 09:08:55 +0000 (09:08 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19293 e93f8b46-1217-0410-a6f0-8f06a7374b81

.rubocop_todo.yml
app/models/auth_source_ldap.rb

index 9e9f691dbe676029f8e5c785f0109e02ec4f890a..660d9ee84e67abb73667482163db6d2667b49410 100644 (file)
@@ -179,7 +179,6 @@ Layout/MultilineArrayBraceLayout:
 Layout/MultilineHashBraceLayout:
   Exclude:
     - 'app/controllers/context_menus_controller.rb'
-    - 'app/models/auth_source_ldap.rb'
     - 'lib/redmine/access_keys.rb'
     - 'lib/redmine/helpers/time_report.rb'
     - 'lib/redmine/scm/adapters/bazaar_adapter.rb'
index 3e1b7c10b5f9772823353c763e2974224fa2cd4a..2a1791a665a478955f72b45f88a0aaad12270380 100644 (file)
@@ -70,8 +70,7 @@ class AuthSourceLdap < AuthSource
   def test_connection
     with_timeout do
       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?
         ldap_auth = authenticate_dn(self.account, self.account_password)
         raise AuthSourceException.new(l(:error_ldap_bind_credentials)) if !ldap_auth
@@ -177,20 +176,19 @@ class AuthSourceLdap < AuthSource
   end
 
   def initialize_ldap_con(ldap_user, ldap_password)
-    options = { :host => self.host,
-                :port => self.port
-              }
+    options = {:host => self.host, :port => self.port}
     if tls
       options[:encryption] = {
         :method => :simple_tls,
         # Always provide non-empty tls_options, to make sure, that all
         # OpenSSL::SSL::SSLContext::DEFAULT_PARAMS as well as the default cert
         # store are used.
-        :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
-
-    options.merge!(:auth => { :method => :simple, :username => ldap_user, :password => ldap_password }) unless ldap_user.blank? && ldap_password.blank?
+    unless ldap_user.blank? && ldap_password.blank?
+      options.merge!(:auth => {:method => :simple, :username => ldap_user, :password => ldap_password})
+    end
     Net::LDAP.new options
   end