-
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] Syncing Privacy Notices and Privacy Experiences #3292
[Backend] Syncing Privacy Notices and Privacy Experiences #3292
Conversation
…ivacyExperience. One table stores the experiences for a given region and component, the other table stores common language shared between experiences. - Add new endpoints to update ExperienceLanguage. These can trigger changes to PrivacyExperiences.
- Remove constraint that you can't have both a link overlay and a banner overlay for the same region. - Add unique constraint on region/component for PrivacyExperience - Add ability to upsert experiences when privacy notices change. - Add 50 states
…argeted way. Change reponse to be "linked_regions" instead of "added_regions" to reflect what is important here.
…iences # Conflicts: # src/fides/api/ops/api/v1/endpoints/privacy_notice_endpoints.py
…ienceConfig if regions are not compatible with a given ExperienceConfig.
… just in case so this is not a field we have to check notices for.
…move the obsolete update/create experience endpoints as these are no longer edited directly.
…points into separate files for easier review.
Passing run #2041 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
…on't have valid language associated.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3292 +/- ##
==========================================
+ Coverage 86.86% 87.06% +0.20%
==========================================
Files 308 309 +1
Lines 18540 18821 +281
Branches 2423 2461 +38
==========================================
+ Hits 16104 16386 +282
Misses 1995 1995
+ Partials 441 440 -1
☔ View full report in Codecov by Sentry. |
…e endpoints and update logging.
src/fides/api/ctl/migrations/versions/b546ce845e6c_split_privacy_experience_table.py
Show resolved
Hide resolved
src/fides/api/ops/api/v1/endpoints/privacy_experience_config_endpoints.py
Show resolved
Hide resolved
@allisonking, @eastandwestwind, @NevilleS could you take a look at the changes made here? Playing with the postman collection here is a good way to get up to speed with what's happening. |
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.
This looks great overall, just a couple Qs for you @pattisdr. Also I haven't manually tested this PR yet, just looked over the code portion.
src/fides/api/ops/api/v1/endpoints/privacy_experience_config_endpoints.py
Outdated
Show resolved
Hide resolved
src/fides/api/ops/api/v1/endpoints/privacy_experience_config_endpoints.py
Show resolved
Hide resolved
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.
👏
Closes #3252, #3226, #3241
❗ Contains data migration
❗ Breaks existing privacy experiences
❗
Expected to break Admin UI around retrieving experiences. Admin UI for experiences should call new experience config endpoints instead.❗ Components should still call existing experience endpoints although the response body has changed.
Description Of Changes
See backend design here
Medium-sized data model changes to ensure there is always a valid Privacy Experience for each region at all times and keep edits to an experience for one region from conflicting with another. In short, adjusts PrivacyExperiences so instead of representing multiple regions, they represent a single region. Create a new PrivacyExperienceConfig table to share common language like banner text and link labels between experiences. PrivacyExperiences are linked to a PrivacyExperienceConfig via FK. There are also historical tables for both experiences and experienceconfig to track how both of these changed over time for consent reporting.
Further, each time Privacy Notices are created or updated, adjust Privacy Experiences behind the scenes so we have an experience that covers all the notices. Additionally, when PrivacyExperienceConfigs are updated, also adjust the PrivacyExperiences to match, provided none of the rules with notices are violated. In other words, PrivacyExperiences are not edited directly, but indirectly by PrivacyNotice or PrivacyExperienceConfig updates.
Removes the PrivacyExperienceTemplate table (this wasn't yet being used). My goal instead is to have a few "PrivacyExperienceConfig" records that are labeled as "default" that we can link to when we need to create or update a PrivacyExperience on the user's behalf.
Code Changes
Model changes
PrivacyExperience
table into two halves: thePrivacyExperience
andPrivacyExperienceConfig
table. EachPrivacyExperience
now supports only a single region. Create historical tables for both.Experience Config
POST {{host}}/experience-config
andPATCH {{host}}/experience-config/{{experience-config-id}}
for creating and editing experience configs. Have these endpoints create or update a single resource instead of multiple to reduce complexity due to the fact that several PrivacyExperience updates happen behind the scenes.Privacy Experience
{{host}}/privacy-experience/?region=eu_de
- since things like component title and banner title are now stored on a different record, these details are now nested under the experience_config_id field.has_config
to PrivacyExperienceList endpoint to surface which experiences have and don't have the "experience config" linked. If there's no experience config linked, there's no text for the banners, overlays, or linksexperience_config_id
and theexperience_config_history_id
so if the experience config is updated, this triggers a version bump on the experience.Privacy Notice
Worth noting
Steps to Confirm
See postman collection
POST {{host}}/privacy-notice
GET {{host}}/privacy-experience/
for each region.experience_config
exists yetPOST {{host}}/experience-config
.GET {{host}}/privacy-experience/
for the relevant regions to see that ExperienceConfig is linked to the experience{{host}}/experience-config/{{experience-config-id}}
with various types of edits including component, overlay and regions to see that certain regions are blocked if they'll interfere with notices for that region.Pre-Merge Checklist
CHANGELOG.md