From 455d9e6b47ae7096511a598b81b9bd651ef492ef Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Fri, 6 Oct 2023 14:44:00 -0400 Subject: [PATCH] remove the email and username redacting frmo the role loop I guess this worked because user is guaranteed to have a role? --- lib/galaxy/managers/users.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index f656a1634929..62790853a857 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -209,7 +209,7 @@ def purge(self, user, flush=True): # Deleting multiple times will re-hash the username/email email_hash = new_secure_hash_v2(user.email + pseudorandom_value) uname_hash = new_secure_hash_v2(user.username + pseudorandom_value) - # We must also redact username + # Redact all roles user has for role in user.all_roles(): if self.app.config.redact_username_during_deletion: role.name = role.name.replace(user.username, uname_hash) @@ -218,11 +218,12 @@ def purge(self, user, flush=True): if self.app.config.redact_email_during_deletion: role.name = role.name.replace(user.email, email_hash) role.description = role.description.replace(user.email, email_hash) - user.email = email_hash - user.username = uname_hash private_role.name = email_hash private_role.description = f"Private Role for {email_hash}" self.session().add(private_role) + # Redact user's email and username + user.email = email_hash + user.username = uname_hash # Redact user addresses as well if self.app.config.redact_user_address_during_deletion: user_addresses = (