20170713000001_omniauth_office365_setting.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class OmniauthOffice365Setting < ActiveRecord::Migration[4.2]
  3. def up
  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: 'Authentication via %s',
  8. name: 'auth_microsoft_office365',
  9. area: 'Security::ThirdPartyAuthentication',
  10. description: 'Enables user authentication via %s. Register your app first at [%s](%s).',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: true,
  16. name: 'auth_microsoft_office365',
  17. tag: 'boolean',
  18. options: {
  19. true => 'yes',
  20. false => 'no',
  21. },
  22. },
  23. ],
  24. },
  25. preferences: {
  26. controller: 'SettingsAreaSwitch',
  27. sub: ['auth_microsoft_office365_credentials'],
  28. title_i18n: ['Office 365'],
  29. description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://portal.azure.com'],
  30. permission: ['admin.security'],
  31. },
  32. state: false,
  33. frontend: true
  34. )
  35. Setting.create_if_not_exists(
  36. title: 'Office 365 App Credentials',
  37. name: 'auth_microsoft_office365_credentials',
  38. area: 'Security::ThirdPartyAuthentication::Office365',
  39. description: 'Enables user authentication via Office 365.',
  40. options: {
  41. form: [
  42. {
  43. display: 'App ID',
  44. null: true,
  45. name: 'app_id',
  46. tag: 'input',
  47. },
  48. {
  49. display: 'App Secret',
  50. null: true,
  51. name: 'app_secret',
  52. tag: 'input',
  53. },
  54. ],
  55. },
  56. state: {},
  57. preferences: {
  58. permission: ['admin.security'],
  59. },
  60. frontend: false
  61. )
  62. end
  63. end