-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: redacting user retirement data in lms #37886
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
base: master
Are you sure you want to change the base?
Changes from all commits
19fc427
5ac51b6
b0e4bce
3c338d4
5972c46
83e52e1
6a33726
74f4aaa
0f4e143
23cac02
0f17086
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1024,14 +1024,20 @@ def cleanup(self, request): | |
|
|
||
| ``` | ||
| { | ||
| 'usernames': ['user1', 'user2', ...] | ||
| 'usernames': ['user1', 'user2', ...], | ||
| 'redacted_username': 'Value to store in username field', | ||
| 'redacted_email': 'Value to store in email field', | ||
| 'redacted_name': 'Value to store in name field' | ||
| } | ||
| ``` | ||
|
|
||
| Deletes a batch of retirement requests by username. | ||
| Redacts a batch of retirement requests by redacting PII fields. | ||
| """ | ||
| try: | ||
| usernames = request.data["usernames"] | ||
| redacted_username = request.data.get("redacted_username", "redacted") | ||
| redacted_email = request.data.get("redacted_email", "redacted") | ||
| redacted_name = request.data.get("redacted_name", "redacted") | ||
|
|
||
| if not isinstance(usernames, list): | ||
| raise TypeError("Usernames should be an array.") | ||
|
|
@@ -1045,7 +1051,16 @@ def cleanup(self, request): | |
| if len(usernames) != len(retirements): | ||
| raise UserRetirementStatus.DoesNotExist("Not all usernames exist in the COMPLETE state.") | ||
|
|
||
| retirements.delete() | ||
| # Redact PII fields first, then delete. In case an ETL tool is syncing data | ||
| # to a downstream data warehouse, and treats the deletes as soft-deletes, | ||
| # the data will have first been redacted, protecting the sensitive PII. | ||
| for retirement in retirements: | ||
| retirement.original_username = redacted_username | ||
| retirement.original_email = redacted_email | ||
| retirement.original_name = redacted_name | ||
| retirement.save() | ||
| retirement.delete() | ||
|
Comment on lines
+1054
to
+1062
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ktyagiapphelix2u: I thought you had said this work was complete. I guess I misunderstood. Either way, please take care of this and all copilot comments. Thank you.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. Is this a very outdated duplicate PR for openedx? We should discuss our process, but I would have imagined that this would be the PR we start with.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @robrap You are seeing the old PR, the new PR is in edx/edx-platform. Thanks.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, let's work in openedx first. For this, let's wrap up the review in edx#105, and you can squash *when done on the other branch) and use it to update this branch, so we can have the reviewers get a chance to see this again since it has been updated. Thank you. |
||
|
|
||
| return Response(status=status.HTTP_204_NO_CONTENT) | ||
| except (RetirementStateError, UserRetirementStatus.DoesNotExist, TypeError) as exc: | ||
| return Response(str(exc), status=status.HTTP_400_BAD_REQUEST) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.