Important: If you are a Zammad Support or hosted customer and experience a technical issue, please refer to: support@zammad.com using your zammad-hostname / or company contract.
How do I delete users within the database? I just tried to delete two users via psql DELETE FROM roles_users WHERE user_id = '123'; DELETE FROM users WHERE id = '123';
After Zammad restart, I can not access the webinterface and the production.log says E, [2018-09-06T11:00:21.633953 #25729] ERROR -- : Couldn't find User with 'id'=10 (ActiveRecord::RecordNotFound)
I donāt know, I would add them back and wait for the new delete user feature.
there are 93 tables and any table that references the users table will need to be checked for rows that have the user id 123 in it and updated, and then who knows what snowball effect that will have.
sure. This is how I think you could do it by hand, Iām probably wrong so I wouldnāt do it. Any row in any of the 93 tables that references user_id 123 will need to be updated or deleted, if you decide on delete then any row in any of the 93 tables that references the row you just deleted will need to be updated or deleted, and if you decide on delete, then any row in any of the 93 tables that references the row you just deleted will need to be updated or deleted, and if you decide on deleteā¦
I guess elasticsearch will need to be reindexed too, thatās not such a big deal.
Honestly I was hoping for a nifty SQL statement from Zammad devs as they surely have done it quite some times already and of course know the db structure best
Anyway, I restored my latest snapshot to continue.
Sorry, I might not be clear enough here.
You can use the following snippet to remove a user completely.
Please not that we officially do not support it.
Use on your own risk.
users_by_email = ['some@exmaple.net', 'some@exmaple.com']
list = ''
users_by_email.each {|email|
User.where(email: email.downcase).each {|user|
next if user.id == 1
next if !user.permissions?('ticket.customer')
list += "Customer #{user.login}/#{user.email}/#{user.id} has #{Ticket.where(customer_id: user.id).count} tickets #{Ticket.where(customer_id: user.id).pluck(:number)}\n"
}
}
puts list
users_by_email = ['some@exmaple.net', 'some@exmaple.com']
list = ''
users_by_email.each {|email|
User.where(email: email.downcase).each {|user|
next if user.id == 1
next if !user.permissions?('ticket.customer')
list += "Customer #{user.login}/#{user.email}/#{user.id} has #{Ticket.where(customer_id: user.id).count} tickets #{Ticket.where(customer_id: user.id).pluck(:number)}\n"
Ticket.where(customer_id: user.id).each {|ticket|
list += " Delete ticket #{ticket.number}\n"
ticket.destroy
}
list += " Delete user #{user.login}/#{user.email}\n"
user.destroy
}
}
puts list
Edit: You need to get rid of all references, otherwise Zammad will react in unexpected ways.
@MrGeneration Is there anywhere (github issue, email, etc) we can follow the status/progress of the user deletion feature?
We are eagerly waiting the release of this feature so we can move forward with zammad. This feature is vital/crucial as you cannot have a GDPR compliant installation of zammad without the ability to delete user data.
I donāt know the different steps of our dev-guys. They recently changed some thing in terms of QAing.
My guess that itās frozen (so it stays super duper fresh). Now to be honest, i think itās simply waiting for QA. Donāt know when it will come.
@thorsteneckel might be the better reference than I am. :>
The icebox is a āSCRUMā term and means in our context that the assigned dev is currently stuck on this task and needs input/feedback/help etc. This makes it easy for us to see the current state of everything - real progress or not.
However, in this particular case itās because we need some help with the frontend part. Our frontend resources are limited / currently working on other and higher prioritized tasks. As soon as this changes we will take the issue out of the icebox and continue working on it.
Also, looking forward to have delete user and all related ticket to that user in the admin settingsā¦
I saw other system that have delete option of the user and data, if you select the delete only a soft delete means totally hide in the system but you can also back data and then there is a other option āpurgeā means all soft delete data will totaly delete in the system and to the database.