Skip to content
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

feat: purge name from certificate records during learner retirement #34799

Conversation

justinhynes
Copy link
Contributor

Description

[APER-3241]

This PR updates the retirement pipeline to purge learners' names from certificate records when their account is being retired.

It also introduces a new management command that can be used by Open edX operators to purge the leftover name data (PII data) from the certificates_generatedcertificate table. This is designed as a one-time use data fixup, as the retirement functionality should clean this up now.

Comment on lines -1485 to 1527
def _data_sharing_consent_assertions(self):
"""
Helper method for asserting that ``DataSharingConsent`` objects are retired.
"""
self.consent.refresh_from_db()
assert self.retired_username == self.consent.username
test_users_data_sharing_consent = DataSharingConsent.objects.filter(
username=self.original_username
)
assert not test_users_data_sharing_consent.exists()

def test_can_retire_users_sap_success_factors_audits(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved these verification functions to the top of the file. Generally, I get confused when helper and assertion functions are mixed in with all the tests.

I try to keep things like this:

  1. setUp/tearDown functions
  2. helper and assert/verification functions
  3. test cases

If y'all think I'm being too particular, let me know.

@justinhynes justinhynes force-pushed the jhynes/APER-3241_purge-leftover-pii-from-certificate-records branch 3 times, most recently from 3c8bf14 to d5561f9 Compare May 15, 2024 13:03
@justinhynes justinhynes marked this pull request as ready for review May 15, 2024 13:39
@justinhynes justinhynes requested a review from a team as a code owner May 15, 2024 13:39
Copy link
Member

@deborahgu deborahgu left a comment

Choose a reason for hiding this comment

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

this looks nice. Almost all of my comments are nits about, well, comments. I'm pretty sure the only 2 substantive comments I have are to add a dry run because it would be so simple to, and to check on the efficiency of adding the other filter.

(like the Credentials IDA).

This management command functions by requesting a list of learners' user_ids whom have completed their journey
through the retirement pipeline. The `get_retired_user_ids` utility function is responsible for removing any
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
through the retirement pipeline. The `get_retired_user_ids` utility function is responsible for removing any
through the retirement pipeline. The `get_retired_user_ids` utility function is responsible for filtering out any

because "removing" is ambiguous in this context.

openedx/core/djangoapps/user_api/tests/test_api.py Outdated Show resolved Hide resolved
Copy link
Member

@deborahgu deborahgu left a comment

Choose a reason for hiding this comment

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

looks good to me

[APER-3241]

This PR updates the retirement pipeline to purge learners' names from certificate records when their account is being retired.

It also introduces a new management command that can be used by Open edX operators to purge the leftover name data (PII data) from the `certificates_generatedcertificate` table. This is designed as a one-time use data fixup, as the retirement functionality should clean this up now.
@justinhynes justinhynes force-pushed the jhynes/APER-3241_purge-leftover-pii-from-certificate-records branch from 59de534 to fd805e0 Compare May 16, 2024 12:20
@justinhynes justinhynes merged commit 9fbc6e3 into master May 16, 2024
47 checks passed
@justinhynes justinhynes deleted the jhynes/APER-3241_purge-leftover-pii-from-certificate-records branch May 16, 2024 13:17
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

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