20180911064647_issue_2140_reset_ldap_config.rb 635 B

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