20150960000001_update_settings3.rb 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. class UpdateSettings3 < ActiveRecord::Migration
  2. def up
  3. Setting.create_or_update(
  4. title: 'Maximal failed logins',
  5. name: 'password_max_login_failed',
  6. area: 'Security::Password',
  7. description: 'Maximal failed logins after account is inactive.',
  8. options: {
  9. form: [
  10. {
  11. display: '',
  12. null: true,
  13. name: 'password_max_login_failed',
  14. tag: 'select',
  15. options: {
  16. 4 => ' 4',
  17. 5 => ' 5',
  18. 6 => ' 6',
  19. 7 => ' 7',
  20. 8 => ' 8',
  21. 9 => ' 9',
  22. 10 => '10',
  23. 11 => '11',
  24. 13 => '13',
  25. 14 => '14',
  26. 15 => '15',
  27. 16 => '16',
  28. 17 => '17',
  29. 18 => '18',
  30. 19 => '19',
  31. 20 => '20',
  32. },
  33. },
  34. ],
  35. },
  36. state: 10,
  37. frontend: true
  38. )
  39. Setting.create_or_update(
  40. title: 'Max. Email Size',
  41. name: 'postmaster_max_size',
  42. area: 'Email::Base',
  43. description: 'Maximal size in MB of emails.',
  44. options: {
  45. form: [
  46. {
  47. display: '',
  48. null: true,
  49. name: 'postmaster_max_size',
  50. tag: 'select',
  51. options: {
  52. 1 => ' 1',
  53. 2 => ' 2',
  54. 3 => ' 3',
  55. 4 => ' 4',
  56. 5 => ' 5',
  57. 6 => ' 6',
  58. 7 => ' 7',
  59. 8 => ' 8',
  60. 9 => ' 9',
  61. 10 => ' 10',
  62. 15 => ' 15',
  63. 20 => ' 20',
  64. 25 => ' 25',
  65. 30 => ' 30',
  66. 35 => ' 35',
  67. 40 => ' 40',
  68. 45 => ' 45',
  69. 50 => ' 50',
  70. 60 => ' 60',
  71. 70 => ' 70',
  72. 80 => ' 80',
  73. 90 => ' 90',
  74. 100 => '100',
  75. 125 => '125',
  76. 150 => '150',
  77. },
  78. },
  79. ],
  80. },
  81. state: 10,
  82. preferences: { online_service_disable: true },
  83. frontend: false
  84. )
  85. Setting.create_or_update(
  86. title: 'Ticket Number Increment',
  87. name: 'ticket_number_increment',
  88. area: 'Ticket::Number',
  89. description: '-',
  90. options: {
  91. form: [
  92. {
  93. display: 'Checksum',
  94. null: true,
  95. name: 'checksum',
  96. tag: 'boolean',
  97. options: {
  98. true => 'yes',
  99. false => 'no',
  100. },
  101. },
  102. {
  103. display: 'Min. size of number',
  104. null: true,
  105. name: 'min_size',
  106. tag: 'select',
  107. options: {
  108. 1 => ' 1',
  109. 2 => ' 2',
  110. 3 => ' 3',
  111. 4 => ' 4',
  112. 5 => ' 5',
  113. 6 => ' 6',
  114. 7 => ' 7',
  115. 8 => ' 8',
  116. 9 => ' 9',
  117. 10 => '10',
  118. 11 => '11',
  119. 12 => '12',
  120. 13 => '13',
  121. 14 => '14',
  122. 15 => '15',
  123. 16 => '16',
  124. 17 => '17',
  125. 18 => '18',
  126. 19 => '19',
  127. 20 => '20',
  128. },
  129. },
  130. ],
  131. },
  132. state: {
  133. checksum: false,
  134. min_size: 5,
  135. },
  136. frontend: false
  137. )
  138. Setting.create_or_update(
  139. title: 'Minimal size',
  140. name: 'password_min_size',
  141. area: 'Security::Password',
  142. description: 'Password need to have at least minimal size of characters.',
  143. options: {
  144. form: [
  145. {
  146. display: '',
  147. null: true,
  148. name: 'password_min_size',
  149. tag: 'select',
  150. options: {
  151. 4 => ' 4',
  152. 5 => ' 5',
  153. 6 => ' 6',
  154. 7 => ' 7',
  155. 8 => ' 8',
  156. 9 => ' 9',
  157. 10 => '10',
  158. 11 => '11',
  159. 12 => '12',
  160. 13 => '13',
  161. 14 => '14',
  162. 15 => '15',
  163. 16 => '16',
  164. 17 => '17',
  165. 18 => '18',
  166. 19 => '19',
  167. 20 => '20',
  168. },
  169. },
  170. ],
  171. },
  172. state: 6,
  173. frontend: true
  174. )
  175. options = {}
  176. (10..99).each {|item|
  177. options[item] = item
  178. }
  179. system_id = rand(10..99)
  180. current = Setting.find_by(name: 'system_id')
  181. if current
  182. system_id = Setting.get('system_id')
  183. end
  184. Setting.create_or_update(
  185. title: 'SystemID',
  186. name: 'system_id',
  187. area: 'System::Base',
  188. description: 'Defines the system identifier. Every ticket number contains this ID. This ensures that only tickets which belong to your system will be processed as follow-ups (useful when communicating between two instances of Zammad).',
  189. options: {
  190. form: [
  191. {
  192. display: '',
  193. null: true,
  194. name: 'system_id',
  195. tag: 'select',
  196. options: options,
  197. },
  198. ],
  199. },
  200. state: system_id,
  201. preferences: { online_service_disable: true },
  202. frontend: true
  203. )
  204. end
  205. end