feat(cmp): restore vendor-agnostic fields + module wiring
Build + Deploy / build-admin-compliance (push) Successful in 2m0s
Build + Deploy / build-backend-compliance (push) Successful in 14s
Build + Deploy / build-ai-sdk (push) Successful in 10s
Build + Deploy / build-developer-portal (push) Successful in 14s
Build + Deploy / build-tts (push) Successful in 11s
Build + Deploy / build-document-crawler (push) Successful in 11s
Build + Deploy / build-dsms-gateway (push) Successful in 10s
Build + Deploy / build-dsms-node (push) Successful in 13s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 18s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m55s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Successful in 45s
CI / test-python-backend (push) Successful in 41s
CI / test-python-document-crawler (push) Successful in 30s
CI / test-python-dsms-gateway (push) Successful in 26s
CI / validate-canonical-controls (push) Successful in 15s
Build + Deploy / trigger-orca (push) Successful in 2m17s
Build + Deploy / build-admin-compliance (push) Successful in 2m0s
Build + Deploy / build-backend-compliance (push) Successful in 14s
Build + Deploy / build-ai-sdk (push) Successful in 10s
Build + Deploy / build-developer-portal (push) Successful in 14s
Build + Deploy / build-tts (push) Successful in 11s
Build + Deploy / build-document-crawler (push) Successful in 11s
Build + Deploy / build-dsms-gateway (push) Successful in 10s
Build + Deploy / build-dsms-node (push) Successful in 13s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 18s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m55s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Successful in 45s
CI / test-python-backend (push) Successful in 41s
CI / test-python-document-crawler (push) Successful in 30s
CI / test-python-dsms-gateway (push) Successful in 26s
CI / validate-canonical-controls (push) Successful in 15s
Build + Deploy / trigger-orca (push) Successful in 2m17s
Re-add 13 vendor-agnostic columns to banner models/serializers/service (consent_method, banner_version, device_type, browser, os, etc.) that were lost when another session overwrote the code. Keep vendor_consents dict from the other session. Add list_consents method back to BannerConsentService. Wire CookieBanner, Loeschfristen and UseCases into Document Generator contextBridge (CMP_NAME, analytics tools, retention months, feature flags). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,9 @@ class BannerConsentService:
|
||||
consent_version: Optional[int] = None,
|
||||
vendor_consents: Optional[dict[str, bool]] = None,
|
||||
user_agent: Optional[str] = None,
|
||||
*,
|
||||
consent_method: Optional[str] = None,
|
||||
page_url: Optional[str] = None,
|
||||
) -> None:
|
||||
entry = BannerConsentAuditLogDB(
|
||||
tenant_id=tenant_id,
|
||||
@@ -88,6 +91,8 @@ class BannerConsentService:
|
||||
user_agent=user_agent,
|
||||
banner_config_hash=banner_config_hash,
|
||||
consent_version=consent_version,
|
||||
consent_method=consent_method,
|
||||
page_url=page_url,
|
||||
)
|
||||
self.db.add(entry)
|
||||
|
||||
@@ -166,6 +171,16 @@ class BannerConsentService:
|
||||
user_agent: Optional[str],
|
||||
consent_string: Optional[str],
|
||||
vendor_consents: Optional[dict[str, bool]] = None,
|
||||
*,
|
||||
consent_method: Optional[str] = None,
|
||||
page_url: Optional[str] = None,
|
||||
referrer: Optional[str] = None,
|
||||
device_type: Optional[str] = None,
|
||||
browser: Optional[str] = None,
|
||||
os: Optional[str] = None,
|
||||
screen_resolution: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
consent_scope: Optional[str] = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Upsert a device consent row for (tenant, site, device_fingerprint).
|
||||
|
||||
@@ -185,6 +200,21 @@ class BannerConsentService:
|
||||
if not consent_string:
|
||||
consent_string = self._maybe_generate_tc_string(tid, site_id, categories)
|
||||
|
||||
# Vendor-agnostische Zusatzfelder
|
||||
extra = {
|
||||
"consent_method": consent_method,
|
||||
"banner_version": config_ver,
|
||||
"banner_config_hash": config_hash,
|
||||
"page_url": page_url,
|
||||
"referrer": referrer,
|
||||
"device_type": device_type,
|
||||
"browser": browser,
|
||||
"os": os,
|
||||
"screen_resolution": screen_resolution,
|
||||
"session_id": session_id,
|
||||
"consent_scope": consent_scope or "domain",
|
||||
}
|
||||
|
||||
existing = (
|
||||
self.db.query(BannerConsentDB)
|
||||
.filter(
|
||||
@@ -204,11 +234,14 @@ class BannerConsentService:
|
||||
existing.consent_string = consent_string
|
||||
existing.expires_at = expires_at
|
||||
existing.updated_at = now
|
||||
for key, val in extra.items():
|
||||
setattr(existing, key, val)
|
||||
self.db.flush()
|
||||
self._log(
|
||||
tid, existing.id, "consent_updated", site_id, device_fingerprint,
|
||||
categories, ip_hash, config_hash, config_ver,
|
||||
vendor_consents=vendor_consents, user_agent=user_agent,
|
||||
consent_method=consent_method, page_url=page_url,
|
||||
)
|
||||
self.db.commit()
|
||||
self.db.refresh(existing)
|
||||
@@ -225,6 +258,7 @@ class BannerConsentService:
|
||||
user_agent=user_agent,
|
||||
consent_string=consent_string,
|
||||
expires_at=expires_at,
|
||||
**extra,
|
||||
)
|
||||
self.db.add(consent)
|
||||
self.db.flush()
|
||||
@@ -232,6 +266,7 @@ class BannerConsentService:
|
||||
tid, consent.id, "consent_given", site_id, device_fingerprint,
|
||||
categories, ip_hash, config_hash, config_ver,
|
||||
vendor_consents=vendor_consents, user_agent=user_agent,
|
||||
consent_method=consent_method, page_url=page_url,
|
||||
)
|
||||
self.db.commit()
|
||||
self.db.refresh(consent)
|
||||
@@ -369,6 +404,24 @@ class BannerConsentService:
|
||||
],
|
||||
}
|
||||
|
||||
def list_consents(
|
||||
self, tenant_id: str, site_id: Optional[str] = None,
|
||||
limit: int = 50, offset: int = 0,
|
||||
) -> dict[str, Any]:
|
||||
"""List paginated banner consents for admin dashboard."""
|
||||
tid = uuid.UUID(tenant_id)
|
||||
base = self.db.query(BannerConsentDB).filter(BannerConsentDB.tenant_id == tid)
|
||||
if site_id:
|
||||
base = base.filter(BannerConsentDB.site_id == site_id)
|
||||
total = base.count()
|
||||
rows = base.order_by(BannerConsentDB.created_at.desc()).offset(offset).limit(limit).all()
|
||||
return {
|
||||
"consents": [consent_to_dict(c) for c in rows],
|
||||
"total": total,
|
||||
"limit": limit,
|
||||
"offset": offset,
|
||||
}
|
||||
|
||||
def get_site_stats(self, tenant_id: str, site_id: str) -> dict[str, Any]:
|
||||
"""Compute consent count + per-category acceptance rates for a site."""
|
||||
tid = uuid.UUID(tenant_id)
|
||||
|
||||
Reference in New Issue
Block a user