Skip to content

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

Merged
merged 8 commits into from
Feb 19, 2018
Merged

Admin feature: Nuke user #2977

merged 8 commits into from
Feb 19, 2018

Conversation

di
Copy link
Member

@di di commented Feb 19, 2018

Towards fixing #2976.

Remove the user account, any projects they own, associated releases, roles, emails, etc.

@di di requested a review from ewdurbin February 19, 2018 00:14
for project in user.projects:
remove_project(project, request, flash=False)

request.db.delete(user)
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@ewdurbin ewdurbin Feb 19, 2018

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.

Copy link
Member

@ewdurbin ewdurbin Feb 19, 2018

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.

Copy link
Member

@ewdurbin ewdurbin left a 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, 🚢

Copy link
Member

@ewdurbin ewdurbin left a 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?


# Delete projects one by one so they are purged from the cache
for project in user.projects:
remove_project(project, request, flash=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a JournalEntry

Copy link
Member Author

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.

Copy link
Member

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 :)

@ewdurbin ewdurbin merged commit afb2f99 into master Feb 19, 2018
@ewdurbin ewdurbin deleted the nuke-user branch February 19, 2018 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants