Some checks failed
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Failing after 0s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Failing after 4m0s
Test Suite / playwright-tests (push) Failing after 3m41s
- Introduced `email_verified` and `account_state` attributes in the `TenantContext` to improve user state management. - Updated the `resolve_tenant_context` function to dynamically fetch `email_verified` status from the database and determine `account_state` based on user roles and memberships. - Implemented `assert_min_account_state` checks across various endpoints to enforce access control based on user account status. - Incremented version to 1.1.0 in version.py to reflect these enhancements in tenant context management and access control.
28 lines
855 B
Python
28 lines
855 B
Python
"""
|
|
GET /api/me/entitlements — effektive Capabilities + Feature-Kontingente (M4).
|
|
"""
|
|
from typing import Optional
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
|
|
from db import get_db, get_cursor
|
|
from entitlements import build_me_entitlements
|
|
from tenant_context import TenantContext, get_tenant_context
|
|
|
|
router = APIRouter(prefix="/api", tags=["entitlements"])
|
|
|
|
|
|
@router.get("/me/entitlements")
|
|
def get_me_entitlements(
|
|
tenant: TenantContext = Depends(get_tenant_context),
|
|
club_id: Optional[int] = Query(default=None, ge=1, description="Verein (Default: effective_club_id)"),
|
|
):
|
|
"""
|
|
Effektive Rechte für Frontend: Account-Status, Capabilities, Feature-Limits.
|
|
|
|
Spez: CAPABILITY_CATALOG.v1.md §7.1
|
|
"""
|
|
with get_db() as conn:
|
|
cur = get_cursor(conn)
|
|
return build_me_entitlements(cur, tenant, club_id=club_id)
|