20180911064647_issue_2140_reset_ldap_config.rb 712 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # ATTENTION: This migration is most likely not required anymore
  3. # because the encoding error was fixed by using a newer version of the psych gem (3.1.0).
  4. # However, we'll keep it as a regression test.
  5. class Issue2140ResetLdapConfig < ActiveRecord::Migration[5.1]
  6. def up
  7. # return if it's a new setup
  8. return if !Setting.exists?(name: 'system_init_done')
  9. ldap_config = Setting.get('ldap_config')
  10. # finish if LDAP config isn't broken
  11. ldap_config.to_json
  12. rescue Encoding::UndefinedConversionError
  13. ldap_config[:wizardData].delete(:backend_user_attributes)
  14. Setting.set('ldap_config', ldap_config)
  15. end
  16. end