From 8463514a09a934430728da2a295368047ac53b76 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Sun, 8 Nov 2015 13:10:01 -0500 Subject: [PATCH] Fix delete_user call to remove all user data --- data/model/user.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/model/user.py b/data/model/user.py index 1079f8e0d..d05ea1693 100644 --- a/data/model/user.py +++ b/data/model/user.py @@ -651,9 +651,12 @@ def detach_external_login(user, service_name): def delete_user(user): - user.delete_instance(recursive=True, delete_nullable=True) + # Delete any repositories under the user's namespace. + for repo in list(Repository.select().where(Repository.namespace_user == user)): + repository.purge_repository(user.username, repo.name) - # TODO: also delete any repository data associated + # Delete the user itself. + user.delete_instance(recursive=True, delete_nullable=True) def get_pull_credentials(robotname):