Implement Club Feature Enforcement Logic and Update Versioning
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Failing after 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m15s
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Failing after 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m15s
- Introduced a new environment variable `CLUB_FEATURE_ENFORCE` to control club feature access, allowing values of 1, true, or yes for activation. - Updated the backend logic to check for club feature enforcement, raising HTTP exceptions when access is denied without an active club context. - Enhanced the admin rights router with a new endpoint to check the enforcement status of club features. - Incremented application version to 0.8.202 to reflect these changes.
This commit is contained in:
1 parent
4130a63dfe
commit
a9a6153ed5
12 files changed
+81
-7
No files matched your search
@@ -3,6 +3,7 @@ Superadmin: Rollen & Rechte — Capability-Grants, Kontingent-Bypass, Vereins-Ko
|
||||
|
||||
Ein Router für das Rechtesystem (M6). Kein paralleles Exemption-Schema.
|
||||
"""
|
||||
import os
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
@@ -15,10 +16,12 @@ from club_quota_bypass import (
|
||||
list_quota_bypass_grants,
|
||||
quota_bypass_capability_id_for_feature,
|
||||
)
|
||||
from capabilities import capability_enforcement_enabled
|
||||
from capability_enforcement_audit import (
|
||||
enforcement_status_for_capability,
|
||||
feature_consume_status,
|
||||
)
|
||||
from club_features import club_feature_enforcement_enabled
|
||||
from club_tenancy import is_superadmin
|
||||
from db import get_db, get_cursor, r2d
|
||||
|
||||
@@ -83,6 +86,26 @@ class QuotaBypassProfileBody(BaseModel):
|
||||
reason: Optional[str] = Field(None, max_length=500)
|
||||
|
||||
|
||||
# ── Enforcement-Diagnose (Superadmin) ────────────────────────────────────────
|
||||
|
||||
@router.get("/enforcement-status")
|
||||
def get_enforcement_status(session: dict = Depends(require_auth)):
|
||||
"""Prüft ob Hard-Block-Env im laufenden Container/Prozess ankommt."""
|
||||
_require_superadmin(session)
|
||||
raw = os.getenv("CLUB_FEATURE_ENFORCE", "0")
|
||||
return {
|
||||
"club_feature_enforce_active": club_feature_enforcement_enabled(),
|
||||
"club_feature_enforce_raw": raw,
|
||||
"capability_enforce_active": capability_enforcement_enabled(),
|
||||
"capability_enforce_raw": os.getenv("CAPABILITY_ENFORCE", "0"),
|
||||
"hints": [
|
||||
"Nach .env-Änderung: docker compose up -d backend (Container neu erstellen).",
|
||||
"Superadmin hat Quota-Bypass — KI-Limit-Test als Trainer, nicht als Superadmin.",
|
||||
"Ohne aktiven Verein (X-Active-Club-Id) blockiert Enforce ebenfalls.",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
# ── Capability-Matrix (Rollen → Fähigkeiten) ─────────────────────────────────
|
||||
|
||||
@router.get("/capability-matrix")
|
||||
|
||||
Reference in new issue
Block a user