Delete all inactive customers

  • Used Zammad version: 3.6.x
  • Used Zammad installation source: package
  • Operating system: Debian 10
  • Browser + version: Google Chrome 86.0.4240.198

Expected behavior:

We recently configured the integration with LDAP, unfortunately we did not use group filtering during the first synchronization, now we have several hundred inactive customers. Is it possible to delete all inative customers at once?

Andreas

Yes it is.

Warning: The following is a -very- destructive operation that can delete productive data.
Only run below command if you’re double sure on what you’re doing.

Remove allllll the inactive users

Do NOT change below command.

User.where(active: false).each {|user| 
   next if user.id == 1
   user.destroy 
}
1 Like

Inactive users are users without any tickets? So it would be safe to run this command on a recurring basis to clean up the database? :nerd_face:

Not necessarily, no.
How should I know? :wink:

The data privacy rules do apply to this topic:
https://admin-docs.zammad.org/en/latest/system/data-privacy.html

So if your inactive user is customer in any ticket, that ticket will be gone as well.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.