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)
|