channel_xoauth2.rb 617 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class ExternalCredential::Base::ChannelXoauth2
  3. def self.channel_area
  4. raise NotImplementedError
  5. end
  6. def self.update_client_secret(previous_client_secret, current_client_secret)
  7. Channel.in_area(channel_area).find_each do |channel|
  8. channel_client_secret = channel.options.dig(:auth, :client_secret)
  9. next if channel_client_secret.blank?
  10. next if channel_client_secret != previous_client_secret
  11. channel.options[:auth][:client_secret] = current_client_secret
  12. channel.save!
  13. end
  14. true
  15. end
  16. end