Skip to content

Commit

Permalink
Follow up - 467bc03 - Fixes zammad#2389 - Broken Setting structure fo…
Browse files Browse the repository at this point in the history
…r Auth::Backend adapters.
  • Loading branch information
thorsteneckel committed Aug 24, 2021
1 parent a7f8855 commit 25178b2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions db/migrate/20210728103633_move_auth_backends_to_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def change
},
state: {
priority: 1,
adapter: 'Auth::Internal',
adapter: 'Auth::Backend::Internal',
},
frontend: false
)
Expand All @@ -34,20 +34,29 @@ def change
},
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
Expand Down

0 comments on commit 25178b2

Please sign in to comment.