20250102164204_add_channel_microsoft_graph.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class AddChannelMicrosoftGraph < ActiveRecord::Migration[7.2]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Permission.create_if_not_exists(
  7. name: 'admin.channel_microsoft_graph',
  8. label: 'Microsoft Graph',
  9. description: 'Manage Microsoft Graph mail channel of your system.',
  10. preferences: { prio: 1255 }
  11. )
  12. settings = %w[
  13. ticket_subject_size
  14. ticket_subject_re
  15. ticket_subject_fwd
  16. ticket_define_email_from
  17. ticket_define_email_from_separator
  18. postmaster_max_size
  19. postmaster_follow_up_search_in
  20. postmaster_sender_based_on_reply_to
  21. postmaster_sender_is_agent_search_for_customer
  22. postmaster_send_reject_if_mail_too_large
  23. notification_sender
  24. send_no_auto_response_reg_exp
  25. ]
  26. Setting.where(name: settings).each do |setting|
  27. setting.preferences[:permission] += ['admin.channel_microsoft_graph']
  28. setting.save
  29. end
  30. end
  31. end