Skip to content

Commit

Permalink
Changes to support new privacy center configs (#5732)
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana authored Feb 7, 2025
1 parent 9b4237a commit b2a7be3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
- Added initial support for upcoming "headless" CMP experience type [#5731](https://github.com/ethyca/fides/pull/5731)
- All Select dropdowns will now allow searching to narrow down the options by default [#5738](https://github.com/ethyca/fides/pull/5738)
- Exposes privacy notice picker for TCF components [#5730](https://github.com/ethyca/fides/pull/5730)
- Model changes to support new privacy center config options [5732](https://github.com/ethyca/fides/pull/5732)

### Fixed
- Fixed `fides annotate dataset` command enters incorrect value on the `direction` field. [#5727](https://github.com/ethyca/fides/pull/5727)
Expand Down
5 changes: 3 additions & 2 deletions src/fides/api/models/location_regulation_selections.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,10 @@ def _load_privacy_notice_regions() -> Dict[str, Union[Location, LocationGroup]]:

# dynamically create an enum based on definitions loaded from YAML
# This is a combination of "locations" and "location groups" for use on Privacy Experiences
PrivacyNoticeRegion: Enum = Enum( # type: ignore[misc]
PrivacyNoticeRegion = Enum( # type: ignore[misc]
"PrivacyNoticeRegion",
{location.id: location.id for location in privacy_notice_regions_by_id.values()},
[(location.id, location.id) for location in privacy_notice_regions_by_id.values()],
type=str,
)

# Create a notice region enum that includes regions we no longer support but still preserve
Expand Down
17 changes: 16 additions & 1 deletion src/fides/api/schemas/privacy_center_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import ConfigDict, Field, field_validator, model_validator

from fides.api.models.location_regulation_selections import PrivacyNoticeRegion
from fides.api.schemas.base_class import FidesSchema

RequiredType = Literal["optional", "required"]
Expand Down Expand Up @@ -54,7 +55,8 @@ def validate_default_value(cls, values: Dict[str, Any]) -> Dict[str, Any]:


class PrivacyRequestOption(FidesSchema):
policy_key: str
locations: Optional[Union[List[PrivacyNoticeRegion], Literal["fallback"]]] = None
policy_key: Optional[str] = None
icon_path: str
title: str
description: str
Expand Down Expand Up @@ -116,6 +118,18 @@ class ConsentConfig(FidesSchema):
page: ConsentConfigPage


class PolicyUnavailableMessages(FidesSchema):
"""
Used to capture the information to present to a user if a policy is unavailable.
"""

title: str
description: str
close_button_text: str
action_button_text: str
action_link: str


class PrivacyCenterConfig(FidesSchema):
"""
NOTE: Add to this schema with care. Any fields added to
Expand All @@ -138,6 +152,7 @@ class PrivacyCenterConfig(FidesSchema):
consent: ConsentConfig
privacy_policy_url: Optional[str] = None
privacy_policy_url_text: Optional[str] = None
policy_unavailable_messages: Optional[PolicyUnavailableMessages] = None


class PartialPrivacyRequestOption(FidesSchema):
Expand Down
10 changes: 10 additions & 0 deletions src/fides/api/schemas/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ class MinimalProperty(FidesSchema):
name: str


class PropertyCreate(FidesSchema):
name: str
type: PropertyType
id: Optional[str] = None
experiences: List[MinimalPrivacyExperienceConfig]
privacy_center_config: Optional[PrivacyCenterConfig] = None
stylesheet: Optional[CssStr] = None
paths: List[str]


class PublicPropertyResponse(FidesSchema):
"""
Schema that represents a `Property` as returned in the
Expand Down
4 changes: 2 additions & 2 deletions tests/service/test_privacy_request_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
PrivacyRequestStatus,
)
from fides.api.models.property import Property
from fides.api.oauth.roles import APPROVER, CONTRIBUTOR, OWNER, VIEWER_AND_APPROVER
from fides.api.oauth.roles import APPROVER
from fides.api.schemas.policy import ActionType
from fides.api.schemas.privacy_request import PrivacyRequestCreate
from fides.api.schemas.redis_cache import CustomPrivacyRequestField, Identity
from fides.api.schemas.redis_cache import Identity
from fides.config.config_proxy import ConfigProxy
from fides.service.messaging.messaging_service import MessagingService
from fides.service.privacy_request.privacy_request_service import PrivacyRequestService
Expand Down

0 comments on commit b2a7be3

Please sign in to comment.