OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix removed LdapError error class
Oliver Günther7e10047827c4
diff --git a/app/models/ldap_auth_source.rb b/app/models/ldap_auth_source.rbindex ea4a9fc78fb..3b45bda9a5a 100644--- a/app/models/ldap_auth_source.rb+++ b/app/models/ldap_auth_source.rb@@ -52,7 +52,7 @@ class LdapAuthSource < AuthSourceRails.logger.debug { "Authentication successful for '#{login}'" }return attrs.except(:dn)end- rescue Net::LDAP::LdapError => error+ rescue Net::LDAP::Error => errorraise 'LdapError: ' + error.messageend@@ -64,7 +64,7 @@ class LdapAuthSource < AuthSourceRails.logger.debug { "Lookup successful for '#{login}'" }return attrs.except(:dn)end- rescue Net::LDAP::LdapError => error+ rescue Net::LDAP::Error => errorraise 'LdapError: ' + error.messageend@@ -78,7 +78,7 @@ class LdapAuthSource < AuthSourceunless authenticate_dn(account, account_password)raise I18n.t('auth_source.ldap_error', error_message: I18n.t('auth_source.ldap_auth_failed'))end- rescue Net::LDAP::LdapError => text+ rescue Net::LDAP::Error => textraise I18n.t('auth_source.ldap_error', error_message: text.to_s)end@@ -128,7 +128,7 @@ class LdapAuthSource < AuthSourceport: port,force_no_page: true,encryption: ldap_encryption- }+ }options.merge!(auth: { method: :simple, username: ldap_user, password: ldap_password }) unless ldap_user.blank? && ldap_password.blank?Net::LDAP.new optionsenddiff --git a/spec_legacy/unit/user_spec.rb b/spec_legacy/unit/user_spec.rbindex a9903451833..328bf02f77f 100644--- a/spec_legacy/unit/user_spec.rb+++ b/spec_legacy/unit/user_spec.rb@@ -217,7 +217,7 @@ describe User, type: :model docontext 'with failed connection to the LDAP server' doit 'should return nil' do@auth_source = LdapAuthSource.find(1)- allow_any_instance_of(AuthSource).to receive(:initialize_ldap_con).and_raise(Net::LDAP::LdapError, 'Cannot connect')+ allow_any_instance_of(AuthSource).to receive(:initialize_ldap_con).and_raise(Net::LDAP::Error, 'Cannot connect')assert_equal nil, User.try_to_login('edavis', 'wrong')end