Why can't non-developers admins reset the IP field of anonymized accounts?

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.

1 Like

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?

6 Likes

Thank you for your reply!

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:

So I changed it to this:

UserAnonymizer.make_anonymous(user, nil, {anonymize_ip: "0.0.0.0"}) 

And now it works!

3 Likes

Here’s a fully prepped form for others:

UserAnonymizer.make_anonymous(User.find_by_username_or_email("=USERNAME="), nil, anonymize_ip: "0.0.0.0") 
13 Likes

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