20221208131506_issue3971_exchange_oauth2.rb 967 B

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue3971ExchangeOauth2 < ActiveRecord::Migration[6.1]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Setting.create_if_not_exists(
  7. title: 'Exchange OAuth',
  8. name: 'exchange_oauth',
  9. area: 'Integration::Exchange',
  10. description: 'Defines the Exchange OAuth config.',
  11. options: {},
  12. state: {},
  13. preferences: {
  14. prio: 2,
  15. permission: ['admin.integration'],
  16. },
  17. frontend: false,
  18. )
  19. Scheduler.create_if_not_exists(
  20. name: 'Update exchange oauth 2 token.',
  21. method: 'ExternalCredential::Exchange.refresh_token',
  22. period: 10.minutes,
  23. prio: 1,
  24. active: true,
  25. updated_by_id: 1,
  26. created_by_id: 1,
  27. last_run: Time.zone.now,
  28. )
  29. end
  30. end