This repository was archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
1156 email upon privacy request completion #1282
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
cb93b9b
initial infra for email notification subject request completion
eastandwestwind 9b6fdc1
adding new config var for ttl
eastandwestwind 19fed19
changes to accomodate new config var for ttl
eastandwestwind fcebda0
explicit err messages
eastandwestwind ff45764
pull latest, fix conflicts
eastandwestwind b4d68e0
update docs
eastandwestwind 34d119f
gets unit tests working, adds new test
eastandwestwind a1e93fd
formatting, types, respect config var for sending email notification
eastandwestwind 514755c
isort, and update changelog
eastandwestwind c362b39
format
eastandwestwind 03eb704
fix logic to handle access vs deletion
eastandwestwind 50a1119
pull latest, resolve conflicts
eastandwestwind 629b220
sort
eastandwestwind 115fc04
turn off email complete notification in tests by default, override fo…
eastandwestwind ead2eb1
pull latest, fix conflicts
eastandwestwind 6fb8fd2
fix integration test
eastandwestwind a1e2070
cr changes, notably better testing, default to not send emails in dev…
eastandwestwind 29b83de
pull latest, fix conflicts
eastandwestwind 12526ae
remove unneeded test
eastandwestwind 851fdd9
move fixture locally
eastandwestwind 1dcf9ac
move fixture to class level
eastandwestwind c8697b2
method signature
eastandwestwind 50b6a0c
annotate fixture properly
eastandwestwind 4e5326f
get unit test passing locally
eastandwestwind f165598
use Any matcher for integration test
eastandwestwind 13d5a0b
sort
eastandwestwind 040fcf4
fix params in assert
eastandwestwind 0e36740
pull latest, fix conflicts
eastandwestwind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,3 +38,6 @@ analytics_id = "internal" | |
|
|
||
| [admin_ui] | ||
| enabled = true | ||
|
|
||
| [notifications] | ||
| send_request_completion_notification = true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| SUBJECT_IDENTITY_VERIFICATION_TEMPLATE = "subject_identity_verification.html" | ||
| EMAIL_ERASURE_REQUEST_FULFILLMENT = "erasure_request_email_fulfillment.html" | ||
| PRIVACY_REQUEST_COMPLETE_DELETION_TEMPLATE = "privacy_request_complete_deletion.html" | ||
| PRIVACY_REQUEST_COMPLETE_ACCESS_TEMPLATE = "privacy_request_complete_access.html" |
26 changes: 26 additions & 0 deletions
26
src/fidesops/ops/email_templates/templates/privacy_request_complete_access.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Privacy Request Complete</title> | ||
| </head> | ||
| <body> | ||
| <main> | ||
| {% if download_links|length > 1 %} | ||
| <p> | ||
| Your data access has been completed and can be downloaded at the below links. For security purposes, these secret links will expire in 24 hours. | ||
| </p> | ||
| <ul> | ||
| {% for link in download_links %} | ||
| <li> {{link}} </li> | ||
| {% endfor %} | ||
| </ul> | ||
| {% else %} | ||
| <p> | ||
| Your data access has been completed and can be downloaded at {{download_links[0]}}. For security purposes, this secret link will expire in 24 hours. | ||
| </p> | ||
|
|
||
| {% endif %} | ||
| </main> | ||
| </body> | ||
| </html> |
14 changes: 14 additions & 0 deletions
14
src/fidesops/ops/email_templates/templates/privacy_request_complete_deletion.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Privacy Request Complete</title> | ||
| </head> | ||
| <body> | ||
| <main> | ||
| <p> | ||
| Your privacy request for deletion has been completed. | ||
| </p> | ||
| </main> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import logging | ||
| from typing import Any, Optional, Union | ||
| from typing import Any, Optional | ||
|
|
||
| import requests | ||
| from requests import Response | ||
|
|
@@ -8,14 +8,12 @@ | |
| from fidesops.ops.common_exceptions import EmailDispatchException | ||
| from fidesops.ops.email_templates import get_email_template | ||
| from fidesops.ops.models.email import EmailConfig | ||
| from fidesops.ops.models.privacy_request import EmailRequestFulfillmentBodyParams | ||
| from fidesops.ops.schemas.email.email import ( | ||
| EmailActionType, | ||
| EmailForActionType, | ||
| EmailServiceDetails, | ||
| EmailServiceSecrets, | ||
| EmailServiceType, | ||
| SubjectIdentityVerificationBodyParams, | ||
| ) | ||
| from fidesops.ops.util.logger import Pii | ||
|
|
||
|
|
@@ -26,10 +24,7 @@ def dispatch_email( | |
| db: Session, | ||
| action_type: EmailActionType, | ||
| to_email: Optional[str], | ||
| email_body_params: Union[ | ||
| SubjectIdentityVerificationBodyParams, | ||
| EmailRequestFulfillmentBodyParams, | ||
| ], | ||
| email_body_params: Any, | ||
|
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. still having issues with mypy errors here |
||
| ) -> None: | ||
| if not to_email: | ||
| raise EmailDispatchException("No email supplied.") | ||
|
|
@@ -82,6 +77,22 @@ def _build_email( | |
| {"dataset_collection_action_required": body_params} | ||
| ), | ||
| ) | ||
| if action_type == EmailActionType.PRIVACY_REQUEST_COMPLETE_ACCESS: | ||
| base_template = get_email_template(action_type) | ||
| return EmailForActionType( | ||
| subject="Your data is ready to be downloaded", | ||
| body=base_template.render( | ||
| { | ||
| "download_links": body_params.download_links, | ||
| } | ||
| ), | ||
| ) | ||
| if action_type == EmailActionType.PRIVACY_REQUEST_COMPLETE_DELETION: | ||
| base_template = get_email_template(action_type) | ||
| return EmailForActionType( | ||
| subject="Your data has been deleted", | ||
| body=base_template.render(), | ||
| ) | ||
| logger.error("Email action type %s is not implemented", action_type) | ||
| raise EmailDispatchException(f"Email action type {action_type} is not implemented") | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.