Prevent data deletion in the anonymization script

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-04-22 15:40:10 +02:00
parent 0fc9c4c50e
commit f8feff7c55
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 9 additions and 0 deletions

View File

@ -10,7 +10,16 @@ class Command(BaseCommand):
Command to protect sensitive data during the beta phase, to prevent a right escalation. Command to protect sensitive data during the beta phase, to prevent a right escalation.
Phone number, email address, postal address, first and last name are removed. Phone number, email address, postal address, first and last name are removed.
""" """
def add_arguments(self, parser):
parser.add_argument('--force', '-f', action='store_true', help="Actually anonymize data.")
def handle(self, *args, **kwargs): def handle(self, *args, **kwargs):
if not kwargs['force']:
self.stderr.write("CAUTION: This is a dangerous script. This will reset all personal data with "
"sample data. Don't use this in production! If you know what you are doing, "
"please add --force option.")
exit(1)
cur = connection.cursor() cur = connection.cursor()
cur.execute("UPDATE member_profile SET " cur.execute("UPDATE member_profile SET "
"phone_number = '0123456789', " "phone_number = '0123456789', "