20180911064647_issue_2140_reset_ldap_config.rb 434 B

123456789101112131415
  1. class Issue2140ResetLdapConfig < ActiveRecord::Migration[5.1]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. ldap_config = Setting.get('ldap_config')
  6. # finish if LDAP config isn't broken
  7. ldap_config.to_json
  8. rescue Encoding::UndefinedConversionError
  9. ldap_config[:wizardData].delete(:backend_user_attributes)
  10. Setting.set('ldap_config', ldap_config)
  11. end
  12. end