feat: complete Phase 4 enforcement for all features (backend)
Alle 11 Features blockieren jetzt bei Limit-Überschreitung: Batch 1 (bereits erledigt): - weight_entries, circumference_entries, caliper_entries Batch 2: - activity_entries - nutrition_entries (CSV import) - photos Batch 3: - ai_calls (einzelne Analysen) - ai_pipeline (3-stufige Gesamtanalyse) - data_export (CSV, JSON, ZIP) - data_import (ZIP) Entfernt: Alte check_ai_limit() Calls (ersetzt durch neue Feature-Limits) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
d13c2c7e25
commit
4b8e6755dc
6 files changed
+69
-48
No files matched your search
@@ -44,16 +44,20 @@ async def import_zip(
|
||||
"""
|
||||
pid = get_pid(x_profile_id)
|
||||
|
||||
# Phase 2: Check feature access (non-blocking, log only)
|
||||
# Phase 4: Check feature access and ENFORCE
|
||||
access = check_feature_access(pid, 'data_import')
|
||||
log_feature_usage(pid, 'data_import', access, 'import_zip')
|
||||
|
||||
if not access['allowed']:
|
||||
logger.warning(
|
||||
f"[FEATURE-LIMIT] User {pid} would be blocked: "
|
||||
f"[FEATURE-LIMIT] User {pid} blocked: "
|
||||
f"data_import {access['reason']} (used: {access['used']}, limit: {access['limit']})"
|
||||
)
|
||||
# NOTE: Phase 2 does NOT block - just logs!
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail=f"Limit erreicht: Du hast das Kontingent für Daten-Importe überschritten ({access['used']}/{access['limit']}). "
|
||||
f"Bitte kontaktiere den Admin oder warte bis zum nächsten Reset."
|
||||
)
|
||||
|
||||
# Read uploaded file
|
||||
content = await file.read()
|
||||
|
||||
Reference in new issue
Block a user