I would like to anonymize zammad data (user and organization, and option for tickets title/content, at a minimum), I wonder if the code behind the user removal can be used as a starting point or if I’ll get better options working directly with the database ?
If possible I would like to propose the feature as a zammad addon (maybe just an option associated to backups, I don’t know).
This is very early stage and any input/idea/suggestion will be appreciated. And being sure the topic is not already in the zammad roadmap
I think the easiest way might be to start with a script. If it works fine, you could move it to a lib file, make it OOP and call it over the zammad scheduler.
Example
zammad run rails r script/anonymize_tickets.rb
script/anonymize_tickets.rb
Ticket.where(state_id: Ticket::State.by_category(:closed).select(:id)).where('created_at < ?', 1.year.ago).find_each do |ticket|
ticket.title = 'xxx'
ticket.save!
end