Skip to content

Commit

Permalink
Isolate Served Notice V2 (#4910)
Browse files Browse the repository at this point in the history
Separate LastServedNoticeV2 so it no longer inherits from shared mixins with other privacy preference related models.
This table is now deprecated and will be removed on a future date.
  • Loading branch information
pattisdr authored May 29, 2024
1 parent e5b8ad8 commit ce94c02
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The types of changes are:
## [Unreleased](https://github.com/ethyca/fides/compare/2.37.0...main)

### Added
- Deprecate LastServedNotice (lastservednoticev2) table [#4910](https://github.com/ethyca/fides/pull/4910)
- Added erasure support to the Recurly integration [#4891](https://github.com/ethyca/fides/pull/4891)

### Changed
Expand Down
1 change: 0 additions & 1 deletion src/fides/api/db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
)
from fides.api.models.privacy_preference import (
CurrentPrivacyPreference,
LastServedNotice,
PrivacyPreferenceHistory,
ServedNoticeHistory,
)
Expand Down
52 changes: 46 additions & 6 deletions src/fides/api/models/privacy_preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ def __tablename__(self) -> str:
)


class LastServedNotice(ConsentIdentitiesMixin, Base):
"""Stores the latest served notices for a given user
class LastServedNotice(Base):
"""
DEPRECATED. DO NOT UPDATE THIS TABLE. This will soon be removed.
Email/device id/phone must be unique in this table.
This table consolidates every notice a user has been served, (analogous to CurrentPrivacyPreference
but it is being removed). Backend is not writing to this any longer.
"""

@declared_attr
Expand Down Expand Up @@ -215,6 +217,45 @@ def __tablename__(self) -> str:
),
)

email = Column(
StringEncryptedType(
type_in=String(),
key=CONFIG.security.app_encryption_key,
engine=AesGcmEngine,
padding="pkcs5",
),
) # Encrypted email

fides_user_device = Column(
StringEncryptedType(
type_in=String(),
key=CONFIG.security.app_encryption_key,
engine=AesGcmEngine,
padding="pkcs5",
),
) # Encrypted fides user device

phone_number = Column(
StringEncryptedType(
type_in=String(),
key=CONFIG.security.app_encryption_key,
engine=AesGcmEngine,
padding="pkcs5",
),
) # Encrypted phone number

hashed_email = Column(
String,
index=True,
) # For exact match searches

hashed_fides_user_device = Column(String, index=True) # For exact match searches

hashed_phone_number = Column(
String,
index=True,
) # For exact match searches

@classmethod
def generate_served_notice_history_id(cls) -> str:
"""Generate a served notice history id
Expand Down Expand Up @@ -324,9 +365,8 @@ def __tablename__(self) -> str:

serving_component = Column(EnumColumn(ServingComponent), nullable=False, index=True)

# Identifier generated when a LastServedNotice is created and returned in the response.
# This is saved on all corresponding ServedNoticeHistory records and can be used to link
# PrivacyPreferenceHistory records.
# Generated identifier for the ServedNoticeHistory, used to link a ServedNoticeHistory and PrivacyPreferenceHistory
# record together
served_notice_history_id = Column(String, index=True)

tcf_served = Column(
Expand Down

0 comments on commit ce94c02

Please sign in to comment.