From 9c0b5c53f4f30f007cecb3a0a2ebc383d2def994 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 21 Jun 2017 21:45:41 +0200 Subject: [PATCH] Added patch to delete private user data --- patches/delete-private-data/main.go | 40 +++++++++++++++++++++++++++++ patches/user-references/main.go | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 patches/delete-private-data/main.go diff --git a/patches/delete-private-data/main.go b/patches/delete-private-data/main.go new file mode 100644 index 00000000..51a134a0 --- /dev/null +++ b/patches/delete-private-data/main.go @@ -0,0 +1,40 @@ +package main + +// This patch is disabled because it would be dangerous to run it accidentally. + +func main() { + // color.Yellow("Deleting private user data") + + // // Get a stream of all users + // allUsers, err := arn.AllUsers() + + // if err != nil { + // panic(err) + // } + + // arn.DB.DeleteTable("EmailToUser") + // arn.DB.DeleteTable("GoogleToUser") + + // // Iterate over the stream + // count := 0 + // for user := range allUsers { + // count++ + // println(count, user.Nick) + + // // Delete private data + // user.Email = "" + // user.Gender = "" + // user.FirstName = "" + // user.LastName = "" + // user.IP = "" + // user.Accounts.Facebook.ID = "" + // user.Accounts.Google.ID = "" + // user.AgeRange = arn.UserAgeRange{} + // user.Location = arn.UserLocation{} + + // // Save in DB + // user.Save() + // } + + // color.Green("Finished.") +} diff --git a/patches/user-references/main.go b/patches/user-references/main.go index 4d3a591a..0dbc4a51 100644 --- a/patches/user-references/main.go +++ b/patches/user-references/main.go @@ -12,7 +12,7 @@ func main() { arn.DB.DeleteTable("EmailToUser") arn.DB.DeleteTable("GoogleToUser") - // Get a stream of all anime + // Get a stream of all users allUsers, err := arn.AllUsers() if err != nil {