20161122000001_monitoring_issue_453.rb 984 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class MonitoringIssue453 < 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: 'Monitoring Token',
  8. name: 'monitoring_token',
  9. area: 'HealthCheck::Base',
  10. description: 'Token for Monitoring.',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: false,
  16. name: 'monitoring_token',
  17. tag: 'input',
  18. },
  19. ],
  20. },
  21. state: SecureRandom.urlsafe_base64(40),
  22. preferences: {
  23. permission: ['admin.monitoring'],
  24. },
  25. frontend: false,
  26. )
  27. Permission.create_if_not_exists(
  28. name: 'admin.monitoring',
  29. note: 'Manage %s',
  30. preferences: {
  31. translations: ['Monitoring']
  32. },
  33. )
  34. end
  35. end