Update Membership RBAC Decisions and Enhance Admin Rights Management
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m13s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m13s
- Updated the Membership RBAC Decisions document to reflect the latest implementation status and roadmap, including new features and enhancements. - Incremented application version to 0.8.200 and updated database schema version to 20260606083. - Added a new API endpoint to clear capability grants for club roles, improving admin rights management. - Enhanced the Admin Rights page in the frontend to display enforcement status and feature consumption details for capabilities. - Improved the user interface for better clarity on rights and capabilities management.
This commit is contained in:
1 parent
b68185842e
commit
9d52aeab67
7 files changed
+448
-124
No files matched your search
@@ -0,0 +1,94 @@
|
||||
"""
|
||||
Audit: Welche Capabilities sind an Endpoints angebunden?
|
||||
|
||||
Für Admin-Matrix (Rollen & Rechte) und Roadmap — bei neuem probe_capability hier eintragen.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
# Endpoints rufen probe_capability auf (Log; Block nur bei CAPABILITY_ENFORCE=1)
|
||||
WIRED_PROBE = frozenset(
|
||||
{
|
||||
"exercises.ai.suggest",
|
||||
"exercises.ai.regenerate",
|
||||
"exercises.create",
|
||||
"exercises.media.upload",
|
||||
"planning.ai.suggest",
|
||||
"planning.ai.progression_path",
|
||||
"club.creation_request.read_own",
|
||||
"club.creation_request.create",
|
||||
"club.creation_request.withdraw",
|
||||
"platform.club_creation.approve",
|
||||
}
|
||||
)
|
||||
|
||||
# Kontingent-Verbrauch nach Erfolg (consume_club_feature_with_usage)
|
||||
FEATURE_CONSUME_WIRED = frozenset(
|
||||
{
|
||||
"ai_calls",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def enforcement_status_for_capability(capability_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Anzeige-Status für Superadmin-Matrix.
|
||||
|
||||
level: probe | legacy | platform | open | none
|
||||
"""
|
||||
cid = (capability_id or "").strip()
|
||||
if cid in WIRED_PROBE:
|
||||
return {
|
||||
"level": "probe",
|
||||
"label": "API vorbereitet (Log)",
|
||||
"detail": "probe_capability am Endpoint; Hard-Block erst mit CAPABILITY_ENFORCE=1",
|
||||
"implemented": True,
|
||||
}
|
||||
if cid.startswith("platform."):
|
||||
if cid == "platform.admin.access":
|
||||
return {
|
||||
"level": "platform",
|
||||
"label": "Plattform (Router-Guard)",
|
||||
"detail": "RequireAdmin / Superadmin-Checks",
|
||||
"implemented": True,
|
||||
}
|
||||
if cid in WIRED_PROBE:
|
||||
pass
|
||||
return {
|
||||
"level": "platform",
|
||||
"label": "Plattform (teilweise)",
|
||||
"detail": "Meist Router-Guard; Capability-Probe nur wo eingetragen",
|
||||
"implemented": cid in WIRED_PROBE,
|
||||
}
|
||||
if cid.startswith("club."):
|
||||
return {
|
||||
"level": "open",
|
||||
"label": "Onboarding",
|
||||
"detail": "Account-State / eigene Flows",
|
||||
"implemented": cid in WIRED_PROBE,
|
||||
}
|
||||
# Vereins-Capabilities ohne Probe: Legacy club_tenancy (can_plan_in_club, has_club_role, …)
|
||||
return {
|
||||
"level": "legacy",
|
||||
"label": "Nur Legacy-Rollen",
|
||||
"detail": "Noch kein probe_capability — prüft can_plan_in_club / club_admin im Code",
|
||||
"implemented": False,
|
||||
}
|
||||
|
||||
|
||||
def feature_consume_status(feature_id: str) -> Dict[str, Any]:
|
||||
fid = (feature_id or "").strip()
|
||||
if fid in FEATURE_CONSUME_WIRED:
|
||||
return {
|
||||
"level": "consume",
|
||||
"label": "Verbrauch aktiv",
|
||||
"detail": "consume_club_feature_with_usage + feature_usage in Response",
|
||||
"implemented": True,
|
||||
}
|
||||
return {
|
||||
"level": "inventory",
|
||||
"label": "Bestand / Probe",
|
||||
"detail": "Probe oder Live-Zählung; kein Consume nach Aktion",
|
||||
"implemented": False,
|
||||
}
|
||||
@@ -15,6 +15,10 @@ from club_quota_bypass import (
|
||||
list_quota_bypass_grants,
|
||||
quota_bypass_capability_id_for_feature,
|
||||
)
|
||||
from capability_enforcement_audit import (
|
||||
enforcement_status_for_capability,
|
||||
feature_consume_status,
|
||||
)
|
||||
from club_tenancy import is_superadmin
|
||||
from db import get_db, get_cursor, r2d
|
||||
|
||||
@@ -94,7 +98,13 @@ def get_capability_matrix(session: dict = Depends(require_auth)):
|
||||
ORDER BY domain, id
|
||||
"""
|
||||
)
|
||||
capabilities = [r2d(r) for r in cur.fetchall()]
|
||||
capabilities = []
|
||||
for row in cur.fetchall():
|
||||
cap = r2d(row)
|
||||
cap["enforcement"] = enforcement_status_for_capability(cap.get("id"))
|
||||
if cap.get("linked_feature_id"):
|
||||
cap["feature_consume"] = feature_consume_status(cap["linked_feature_id"])
|
||||
capabilities.append(cap)
|
||||
|
||||
cur.execute(
|
||||
"""
|
||||
@@ -224,6 +234,27 @@ def add_club_role_capability_grant(
|
||||
return r2d(row)
|
||||
|
||||
|
||||
@router.delete("/capability-grants/club-roles/by-capability")
|
||||
def clear_club_capability_grants(
|
||||
capability_id: str = Query(...),
|
||||
session: dict = Depends(require_auth),
|
||||
):
|
||||
"""Alle Rollen-Grants einer Capability entfernen → wieder offen für alle Mitglieder."""
|
||||
_require_superadmin(session)
|
||||
cap_id = capability_id.strip()
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute(
|
||||
"""
|
||||
DELETE FROM club_role_capability_grants
|
||||
WHERE capability_id = %s
|
||||
""",
|
||||
(cap_id,),
|
||||
)
|
||||
conn.commit()
|
||||
return {"ok": True, "capability_id": cap_id}
|
||||
|
||||
|
||||
@router.delete("/capability-grants/club-roles")
|
||||
def delete_club_role_capability_grant(
|
||||
role_code: str = Query(...),
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
# Shinkan Jinkendo Version Information
|
||||
|
||||
APP_VERSION = "0.8.199"
|
||||
APP_VERSION = "0.8.200"
|
||||
BUILD_DATE = "2026-06-07"
|
||||
DB_SCHEMA_VERSION = "20260606083"
|
||||
|
||||
@@ -16,9 +16,10 @@ MODULE_VERSIONS = {
|
||||
"club_join_requests": "1.0.1", # Depends(get_tenant_context)
|
||||
"club_creation_requests": "1.0.1", # superseded wenn freigegebener Verein gelöscht
|
||||
"admin_users": "1.0.0", # GET /api/admin/users
|
||||
"club_features": "1.6.0", # Standard consume_club_feature_with_usage + merge_feature_usage_into_response
|
||||
"club_features": "1.6.0",
|
||||
"admin_rights": "1.1.0", # Matrix UX, Enforcement-Audit, clear club grants by capability
|
||||
"capability_enforcement_audit": "1.0.0",
|
||||
"club_quota_bypass": "1.0.0", # platform.club_quota.bypass* + Admin-Grants-API
|
||||
"admin_rights": "1.0.0", # M6: Rollen/Rechte — Capabilities, Bypass, Vereins-Kontingente
|
||||
"entitlements": "1.2.0", # capability_quota_bypass in Feature-Map für /me/entitlements
|
||||
"platform_media_storage": "1.0.0", # GET/PUT /api/admin/platform-media-storage (Superadmin-Pfad unter MEDIA_ROOT)
|
||||
"media_rights": "1.3.1", # acting_profile_id in write_audit_log_entry auf Optional[int] (P-13 anonyme Meldungen)
|
||||
|
||||
Reference in new issue
Block a user