Zammad Docker and addon updates

This commit is contained in:
Darren Clarke 2023-05-03 08:20:51 +00:00
parent dab5ce0521
commit aa18d3904e
16 changed files with 1972 additions and 2976 deletions

View file

@ -1,46 +1,50 @@
class HardeningHardenSettings < ActiveRecord::Migration[5.2]
def self.restore_setting(name)
s = Setting.find_by(name: name)
if !s.nil?
s.state_current = s.state_initial
s.save!
end
return if s.nil?
s.state_current = s.state_initial
s.save!
end
def self.set_setting(name, value)
s = Setting.find_by(name: name)
if !s.nil?
s.state_current = { "value" => value }
s.save!
end
return if s.nil?
s.state_current = { 'value' => value }
s.save!
end
def self.up
["ui_send_client_stats", "geo_ip_backend", "geo_location_backend", "image_backend", "geo_calendar_backend"].each { |n|
self.set_setting(n, "")
}
%w[ui_send_client_stats geo_ip_backend geo_location_backend image_backend
geo_calendar_backend].each do |n|
set_setting(n, '')
end
# disable customer ticket creation
self.set_setting("customer_ticket_create", false)
set_setting('customer_ticket_create', false)
# disable user account registration
self.set_setting("user_create_account", false)
set_setting('user_create_account', false)
# bump up min password length
self.set_setting("password_min_size", 10)
set_setting('password_min_size', 10)
# delete default zammad user
nicole = User.find_by(email: "nicole.braun@zammad.org")
if !nicole.nil?
Ticket.where(customer: nicole).destroy_all
nicole.destroy
end
nicole = User.find_by(email: 'nicole.braun@zammad.org')
return if nicole.nil?
Ticket.where(customer: nicole).destroy_all
nicole.destroy
end
def self.down
["ui_send_client_stats", "geo_ip_backend", "geo_location_backend", "image_backend", "geo_calendar_backend"].each { |n|
self.restore_setting(n)
}
["customer_ticket_create", "user_create_account", "password_min_size"].each { |n|
self.restore_setting(n)
}
%w[ui_send_client_stats geo_ip_backend geo_location_backend image_backend
geo_calendar_backend].each do |n|
restore_setting(n)
end
%w[customer_ticket_create user_create_account password_min_size].each do |n|
restore_setting(n)
end
end
end