-
Notifications
You must be signed in to change notification settings - Fork 72
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
[Backend] Save and Retrieve Privacy Preferences by Fides User Device Id #3132
Conversation
Passing run #1555 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3132 +/- ##
==========================================
+ Coverage 87.48% 87.51% +0.03%
==========================================
Files 309 309
Lines 17924 17993 +69
Branches 2325 2337 +12
==========================================
+ Hits 15680 15747 +67
- Misses 1820 1821 +1
- Partials 424 425 +1
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@seanpreston requesting your review since I'm saving privacy preferences here with respect to the new style PrivacyPreferenceHistory and CurrentPrivacyPreference records and you are working on saving this with respect to the old-style Consent records. This is built off of your ProvidedIdentity migration, and I also add a method or two that might be useful for your work. @eastandwestwind I was hoping to get your review on this as well as it's the start of the backend for being able to save and retrieve privacy preferences from things like overlays. |
…vice id provided identity, not just a verified identity like an email or phone number. - Start tracking an optional fides_user_device_provided_identity for PrivacyPreferenceHistory and CurrentPrivacyPreference records. - At least one provided identity must be supplied, but you can also supply both. - If both a verified identity (like email or phone number) and a fides user device id are supplied, consolidate any "current preferences" saved with respect to these records into the same records. - For the "verified identity flow" endpoint that will be called through the privacy center, also allow a fides user device id to be saved, in addition to that verified identity with respect to the privacy preferences. - Store encrypted versions of the fides user device id so we can surface in a report, as well as a hash of the record for filtering. Also have a FK to the provided identity table so we can enforce uniqueness for current privacy preferences. - Add some more code comments to clarify field purposes on the historical record
…s user device id alone, outside of the "verified identity" workflow. This endpoint might be called from an overlay or consent banner. Extract the existing code for saving preferences for a verified identity to be shared with saving preferences for a fides user device id.
…fides user device id
- Fix some other tests to require new backend validation that require preferences must be saved with respect to a specific provided identity id - Add new db annotations - Update the changelog - Update the postman collection
… provided identity.
7e5f060
to
b82b6ea
Compare
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.
Great work on this @pattisdr ! I've gone through your testing steps and confirmed that everything worked as expected for me.
I can send everything expected in PATCH
{{host}}/privacy-preferences
with no issues, from FE for now. We can definitely refactor some into BE later.
src/fides/api/ops/api/v1/endpoints/privacy_preference_endpoints.py
Outdated
Show resolved
Hide resolved
src/fides/api/ops/api/v1/endpoints/privacy_preference_endpoints.py
Outdated
Show resolved
Hide resolved
src/fides/api/ops/api/v1/endpoints/privacy_preference_endpoints.py
Outdated
Show resolved
Hide resolved
One more question as I'm looking through docs- will we need an endpoint to retrieve privacy preference by user id (email / phone)? This can be a follow-up of course depending on need, specifically in privacy center, when an identity is known, but it was a first time visitor. |
@eastandwestwind I am not sure I understand your question. I do have this separate endpoint for retrieving privacy preferences by an email or phone number that's very similar to the request we make in the privacy center now except this returns the new-style privacy preferences. This endpoint requires you follow that flow to verify your identity. |
@pattisdr this was what I was looking for, thanks! |
- Move new get_or_create_fides_user_device_id_provided_identity and get_fides_user_device_id_provided_identity into a consent util. - Update copy paste error in get privacy preferences docstring.
Closes #2838
❗ Contains migration; check downrev before merge
❗ Dependent on #3131
Description Of Changes
fides_user_device_id
that was in the browser instead of just a verified identity like an email or a phone numberCode Changes
CurrentPrivacyPreference.fides_user_device_provided_identity_id
. A unique constraint added here so we maintain one "current" record for each "fides_user_provided_identity_id" and each "privacy_notice"PrivacyPreferenceHistory.fides_user_device_provided_identity_id
PrivacyPreferenceHistory.hashed_fides_user_device
field so we can search historical records by this device id more easilyPrivacyPreferenceHistory.fides_user_device
directly on this field so we can surface for reporting purposes without having to join in the ProvidedIdentity table.get_or_create_fides_user_device_id_provided_identity
to get and create provided identity records for device ides and keeping ProvidedIdentities for a fides user device id unique when saved for the purposes of consent. We separately create these records for privacy requests, and those are not expected to be unique._save_privacy_preferences_for_identities
to be shared between the existing endpoint that saves privacy preferences with respect to a verified identity and the new endpoint that only saves preferences with respect to a fides user device id.PATCH /privacy-preferences
andGET /privacy-preferences?fides_user_device_id=XXXXXX
Steps to Confirm
privacy_notice_history_id
you created above. Verify response matches what you'd expectPre-Merge Checklist
CHANGELOG.md