Follow up - 467bc03224 - Fixes #2389 - Broken Setting structure for Auth::Backend adapters.

This commit is contained in:
Thorsten Eckel 2021-08-24 10:35:55 +02:00
parent a7f8855cea
commit 25178b27b8

View file

@ -18,7 +18,7 @@ class MoveAuthBackendsToDatabase < ActiveRecord::Migration[6.0]
},
state: {
priority: 1,
adapter: 'Auth::Internal',
adapter: 'Auth::Backend::Internal',
},
frontend: false
)
@ -34,20 +34,29 @@ class MoveAuthBackendsToDatabase < ActiveRecord::Migration[6.0]
},
state: {
priority: 2,
adapter: 'Auth::Developer',
adapter: 'Auth::Backend::Developer',
},
frontend: false
)
update_auth_ldap
end
private
def update_auth_ldap # rubocop:disable Metrics/AbcSize
begin
auth_ldap = Setting.find_by(name: 'auth_ldap')
auth_ldap.state_initial[:value][:priority] = 3
auth_ldap.state_initial[:value][:adapter] = 'Auth::Backend::Ldap'
auth_ldap.state_current[:value][:priority] = 3
auth_ldap.state_current[:value][:adapter] = 'Auth::Backend::Ldap'
auth_ldap.save!
rescue => e
Rails.logger.error "Error while updating 'auth_ldap' Setting priority"
Rails.logger.error "Error while updating 'auth_ldap' Setting priority and adapter"
Rails.logger.error e
end
end