In a support discussion titled ‘Why can’t non-developers admins reset the IP field of anonymized accounts?’, Newuser asks why the ability to anonymize IP addresses is restricted to developers, despite the feature existing. They attempted to manually anonymize a user’s IP via Rails console but initially encountered issues due to syntax errors and premature command entry. eviltrout explains that the operation is intentionally limited due to its sensitivity and the need for careful integration with organizational GDPR policies. They also clarify that user.save! is unnecessary since UserAnonymizer handles persistence. After correcting the syntax to {anonymize_ip: "0.0.0.0"}, Newuser confirms the command works. Finally, riking provides a ready-to-use code snippet for others: UserAnonymizer.make_anonymous(User.find_by_username_or_email("=USERNAME="), nil, anonymize_ip: "0.0.0.0"), simplifying the process for admins needing to comply with GDPR requests.
Why is this only available for developers? If the option is there, why not make a button for it?
I tried this:
cd /var/discourse
./launcher enter app
rails c
And then
user = User.find_by_username("username_of_the_user_here")
UserAnonymizer.make_anonymous(user, nil, anonymize_ip => '0.0.0.0')
user.save!
But it doesn’t do anything. Can someone help me? I am just an admin who wants to comply with the GDPR and anonymize the IP-addresses of a user who asked me to.
But I can’t find any documentation on how to do this.
It’s a drastic operation and we want to make sure people integrate it into their existing systems with care and thought. People should make sure it matches their own organization’s standards for GDPR compliance.
As for your code, you needn’t call user.save as the anonymizer class does that for you. The code should still work though. How did you confirm that it did not?
Sorry, I didn’t press enter enough times after the first statement. (So I already entered the second statement while the first one was being executed). However, when I do press enter enough times, I run into this error: