-
Notifications
You must be signed in to change notification settings - Fork 1k
Admin feature: Nuke user #2977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin feature: Nuke user #2977
Conversation
for project in user.projects: | ||
remove_project(project, request, flash=False) | ||
|
||
request.db.delete(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will implicitly cascade to their associated emails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also probably want a JournalEntry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will delete emails and roles for that user.
I thought about adding a JournalEntry
here, but it seems like they're project-specific? E.g., we don't make them when a user account is created, just when stuff changes with a specific project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair, but I would like some record of this feature being used. the journal is freeform. we should just write something to note that an admin used this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JournalEntry(
action='purge_user',
name=f'user:{user.username}',
submitted_by=request.user,
submitted_from=request.remote_addr,
)
would work and can't collide with project names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming the cascade works, 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, we need a slightly heavier confirmation.
type username to confirm?
warehouse/admin/views/users.py
Outdated
|
||
# Delete projects one by one so they are purged from the cache | ||
for project in user.projects: | ||
remove_project(project, request, flash=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a JournalEntry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a JournalEntry
happening in remove_project
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed, sorry I tested the button locally on a user with no projects :)
Towards fixing #2976.
Remove the user account, any projects they own, associated releases, roles, emails, etc.