20160621000001_update_setting_password.rb 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. class UpdateSettingPassword < ActiveRecord::Migration
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. Setting.create_or_update(
  6. title: 'Ignore Escalation/SLA Information',
  7. name: 'import_ignore_sla',
  8. area: 'Import::Base',
  9. description: 'Ignore Escalation/SLA Information form import system.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: true,
  15. name: 'import_ignore_sla',
  16. tag: 'boolean',
  17. options: {
  18. true => 'yes',
  19. false => 'no',
  20. },
  21. },
  22. ],
  23. },
  24. state: false,
  25. frontend: false,
  26. )
  27. Setting.create_or_update(
  28. title: 'Define searchable models.',
  29. name: 'models_searchable',
  30. area: 'Models::Base',
  31. description: 'Define the models which can be searched for.',
  32. options: {},
  33. state: [],
  34. frontend: true,
  35. )
  36. Setting.create_or_update(
  37. title: 'Minimal size',
  38. name: 'password_min_size',
  39. area: 'Security::Password',
  40. description: 'Password need to have at least minimal size of characters.',
  41. options: {
  42. form: [
  43. {
  44. display: '',
  45. null: true,
  46. name: 'password_min_size',
  47. tag: 'select',
  48. options: {
  49. 4 => ' 4',
  50. 5 => ' 5',
  51. 6 => ' 6',
  52. 7 => ' 7',
  53. 8 => ' 8',
  54. 9 => ' 9',
  55. 10 => '10',
  56. 11 => '11',
  57. 12 => '12',
  58. 13 => '13',
  59. 14 => '14',
  60. 15 => '15',
  61. 16 => '16',
  62. 17 => '17',
  63. 18 => '18',
  64. 19 => '19',
  65. 20 => '20',
  66. },
  67. },
  68. ],
  69. },
  70. state: 6,
  71. frontend: false,
  72. )
  73. Setting.create_or_update(
  74. title: '2 lower and 2 upper characters',
  75. name: 'password_min_2_lower_2_upper_characters',
  76. area: 'Security::Password',
  77. description: 'Password need to contain 2 lower and 2 upper characters.',
  78. options: {
  79. form: [
  80. {
  81. display: '',
  82. null: true,
  83. name: 'password_min_2_lower_2_upper_characters',
  84. tag: 'select',
  85. options: {
  86. 1 => 'yes',
  87. 0 => 'no',
  88. },
  89. },
  90. ],
  91. },
  92. state: 0,
  93. frontend: false,
  94. )
  95. Setting.create_or_update(
  96. title: 'Digit required',
  97. name: 'password_need_digit',
  98. area: 'Security::Password',
  99. description: 'Password need to have at least one digit.',
  100. options: {
  101. form: [
  102. {
  103. display: 'Needed',
  104. null: true,
  105. name: 'password_need_digit',
  106. tag: 'select',
  107. options: {
  108. 1 => 'yes',
  109. 0 => 'no',
  110. },
  111. },
  112. ],
  113. },
  114. state: 1,
  115. frontend: false,
  116. )
  117. Setting.create_or_update(
  118. title: 'Maximal failed logins',
  119. name: 'password_max_login_failed',
  120. area: 'Security::Password',
  121. description: 'Maximal failed logins after account is inactive.',
  122. options: {
  123. form: [
  124. {
  125. display: '',
  126. null: true,
  127. name: 'password_max_login_failed',
  128. tag: 'select',
  129. options: {
  130. 4 => ' 4',
  131. 5 => ' 5',
  132. 6 => ' 6',
  133. 7 => ' 7',
  134. 8 => ' 8',
  135. 9 => ' 9',
  136. 10 => '10',
  137. 11 => '11',
  138. 13 => '13',
  139. 14 => '14',
  140. 15 => '15',
  141. 16 => '16',
  142. 17 => '17',
  143. 18 => '18',
  144. 19 => '19',
  145. 20 => '20',
  146. },
  147. },
  148. ],
  149. },
  150. state: 10,
  151. frontend: false,
  152. )
  153. end
  154. end