Skip to content

Conversation

@mariajgrimaldi
Copy link
Contributor

@mariajgrimaldi mariajgrimaldi commented Jan 2, 2026

Description

Use a feature flag to allow permanent deletion of a user and their related objects. This path would skip the retirement pipeline, where some PII is anonymized but still prevents a user from registering again with the same email or username. The feature flag would be off by default, so the current deletion behavior is maintained unless an administrator explicitly enables permanent deletion.

I also considered adding a separate delete endpoint to avoid surprising API users once the flag is enabled. A user could call delete user expecting the usual behavior and instead fully remove the account without realizing that permanent deletion is active. The downside is that we would end up with two delete endpoints that look very similar, which could be confusing.

What do you think about this approach?

Testing instructions

  1. Inlcude this configuration in a tutor plugin to enable permanent deletions:
from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-common-settings",
"""
EOX_CORE_ALLOW_PERMANENT_USER_DELETION = True
"""
    )
)
  1. Create a user using the API or another mechanism, and then call the delete endpoint as usual:
Screenshot from 2026-01-02 12-42-20

Additional information

A client was about to use this API. While reviewing it, we noticed a problem. As with the LMS deletion flow, once a user account is deleted, the same username or email cannot be used again.

This goes against the client’s internal policies. It can also raise GDPR concerns, because the system still appears to keep the user’s PII, even if it is anonymized. This is the main reason for allowing administrators to fully delete users.

Checklist for Merge

  • Tested in a remote environment
  • Updated documentation
  • Rebased master/main
  • Squashed commits

Use a feature flag to enable permanent deleting a user and their associated objects without going through the retirement pipeline where some of the PII is anonymized but not ignored when the user decides to register a second time with the same email or username.
@mariajgrimaldi mariajgrimaldi requested a review from a team as a code owner January 2, 2026 11:45
@mariajgrimaldi
Copy link
Contributor Author

I tried to add test cases for the feature flag, but I am not sure how to change Tutor settings during a test run. Because of it I reverted the commit. Is this even feasible with the current setup?

Comment on lines +279 to +285
# Delete OAuth tokens associated with the user.
retire_dot_oauth2_models(user)

# Unlink LMS social auth accounts
UserSocialAuth.objects.filter(user_id=user.id).delete()

# Delete the user
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should delete these kinds of comments

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.

3 participants