This repository has been 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
Create finished audit log for privacy requests #1040
Merged
seanpreston
merged 13 commits into
main
from
1022_create_finished_audit_log_for_privacy_requests
Aug 9, 2022
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e541bbe
Add finished AuditLog
TheAndrewJackson 0c213b0
Bump fideslib
TheAndrewJackson 7d6fcba
Update test
TheAndrewJackson 9fc429b
Fix format lints
TheAndrewJackson 94bebf3
Lowercase encoding
TheAndrewJackson ca1290c
Update changelog
TheAndrewJackson 219a998
Merge branch 'main' into 1022_create_finished_audit_log_for_privacy_r…
TheAndrewJackson 9e05238
Merge branch 'main' into 1022_create_finished_audit_log_for_privacy_r…
TheAndrewJackson 1d7c904
Fix issue with migration downgrade
TheAndrewJackson c8a2688
Merge branch 'main' into 1022_create_finished_audit_log_for_privacy_r…
TheAndrewJackson 2c9174e
Sort lists in test data tests
TheAndrewJackson ab429b1
format file
TheAndrewJackson 1f73436
Merge branch 'main' into 1022_create_finished_audit_log_for_privacy_r…
TheAndrewJackson 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 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 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
32 changes: 32 additions & 0 deletions
32
src/fidesops/migrations/versions/bab75915670a_add_finished_audit_log.py
This file contains 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,32 @@ | ||
"""Add finished audit log | ||
|
||
Revision ID: bab75915670a | ||
Revises: 3c5e1253465d | ||
Create Date: 2022-08-04 20:18:29.339116 | ||
|
||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "bab75915670a" | ||
down_revision = "3c5e1253465d" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("alter type auditlogaction add value 'finished'") | ||
|
||
|
||
def downgrade(): | ||
op.execute("delete from auditlog where action in ('finished')") | ||
op.execute("alter type auditlogaction rename to auditlogaction_old") | ||
op.execute("create type auditlogaction as enum('approved', 'denied')") | ||
op.execute( | ||
( | ||
"alter table auditlog alter column action type auditlogaction using " | ||
"action::text::auditlogaction" | ||
) | ||
) | ||
op.execute("drop type auditlogaction_old") |
This file contains 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 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 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 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 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
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.
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.
Something that would be nice here is to wrap this new
AuditLog
creation into a transaction withprivacy_request.save(...)
— if one of these operations fails without the other we'd end up with an incomplete state, so it's better to commit them both at once.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.
Good find. That is a potential issue when approved/denied are created as well. All of the audit logs should probably be updated at the same time when this is done.
Would you like this to be addressed in this PR or a follow up?
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.
Let's do it as a follow-up