feat: update application version to 0.8.38 and enhance training planning features
Deploy Development / deploy (push) Failing after 14s
Test Suite / pytest-backend (push) Successful in 5s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Successful in 29s
Deploy Development / deploy (push) Failing after 14s
Test Suite / pytest-backend (push) Successful in 5s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Successful in 29s
- Bumped application version to 0.8.38 in both backend and frontend files. - Updated training planning API to improve permission checks for trainer assignments, allowing club admins to manage training units more effectively. - Enhanced the TrainingPlanningPage with new modal functionality for assigning trainers and improved loading of club member directories. - Updated changelog to reflect the new version and changes made in this release.
This commit is contained in:
1 parent
c778d21b26
commit
9e759a28c6
4 files changed
+428
-91
No files matched your search
@@ -180,21 +180,36 @@ def _assert_training_unit_permission(
|
||||
raise HTTPException(status_code=403, detail="Keine Berechtigung")
|
||||
|
||||
co_eff = _effective_co_trainer_ids_for_row(unit_row)
|
||||
if role not in ["admin", "superadmin"]:
|
||||
if (
|
||||
unit_row["created_by"] != profile_id
|
||||
and unit_row["trainer_id"] != profile_id
|
||||
and profile_id not in co_eff
|
||||
and unit_row.get("lead_trainer_profile_id") != profile_id
|
||||
):
|
||||
raise HTTPException(status_code=403, detail="Keine Berechtigung")
|
||||
|
||||
|
||||
def _assert_delete_training_unit(role: str, created_by: int, profile_id: int) -> None:
|
||||
if role not in ["admin", "superadmin"] and created_by != profile_id:
|
||||
if role in ["admin", "superadmin"]:
|
||||
return
|
||||
gcid = unit_row.get("group_club_id")
|
||||
if gcid is not None and can_manage_club_org(cur, profile_id, int(gcid), role):
|
||||
return
|
||||
if (
|
||||
unit_row["created_by"] != profile_id
|
||||
and unit_row["trainer_id"] != profile_id
|
||||
and profile_id not in co_eff
|
||||
and unit_row.get("lead_trainer_profile_id") != profile_id
|
||||
):
|
||||
raise HTTPException(status_code=403, detail="Keine Berechtigung")
|
||||
|
||||
|
||||
def _assert_delete_training_unit(
|
||||
cur,
|
||||
role: str,
|
||||
created_by: int,
|
||||
profile_id: int,
|
||||
group_club_id: Optional[int],
|
||||
) -> None:
|
||||
if role in ["admin", "superadmin"]:
|
||||
return
|
||||
if created_by == profile_id:
|
||||
return
|
||||
if group_club_id is not None and can_manage_club_org(cur, profile_id, int(group_club_id), role):
|
||||
return
|
||||
raise HTTPException(status_code=403, detail="Keine Berechtigung")
|
||||
|
||||
|
||||
def _assert_club_visible_for_trainer(cur, club_id: int, profile_id: int, role: str) -> None:
|
||||
"""Nicht-Admin: Vereinsbezug für Listen mit club_id (Mitglied genügt; Details filtert WHERE)."""
|
||||
if role in ("admin", "superadmin"):
|
||||
@@ -1018,7 +1033,21 @@ def list_training_units(
|
||||
where = []
|
||||
params = []
|
||||
|
||||
if role not in ["admin", "superadmin"]:
|
||||
skip_involvement_filter = role in ("admin", "superadmin")
|
||||
if not skip_involvement_filter and cid is not None:
|
||||
if can_manage_club_org(cur, profile_id, cid, role):
|
||||
skip_involvement_filter = True
|
||||
if not skip_involvement_filter and gid is not None:
|
||||
cur.execute(
|
||||
"SELECT club_id FROM training_groups WHERE id = %s AND status = 'active'",
|
||||
(gid,),
|
||||
)
|
||||
gcx = cur.fetchone()
|
||||
if gcx and gcx.get("club_id") is not None:
|
||||
if can_manage_club_org(cur, profile_id, int(gcx["club_id"]), role):
|
||||
skip_involvement_filter = True
|
||||
|
||||
if not skip_involvement_filter:
|
||||
where.append(
|
||||
"(tu.created_by = %s OR tg.trainer_id = %s OR tu.lead_trainer_profile_id = %s OR "
|
||||
"COALESCE(tu.assistant_trainer_profile_ids, tg.co_trainer_ids, '[]'::jsonb) "
|
||||
@@ -1090,6 +1119,7 @@ def get_training_unit(unit_id: int, tenant: TenantContext = Depends(get_tenant_c
|
||||
p.name as creator_name,
|
||||
tg.trainer_id AS trainer_id,
|
||||
tg.co_trainer_ids AS co_trainer_ids,
|
||||
tg.club_id AS group_club_id,
|
||||
COALESCE(tu.lead_trainer_profile_id, tg.trainer_id) AS effective_lead_trainer_profile_id,
|
||||
COALESCE(tu.assistant_trainer_profile_ids, tg.co_trainer_ids, '[]'::jsonb)
|
||||
AS effective_assistant_trainer_profile_ids,
|
||||
@@ -1429,7 +1459,12 @@ def delete_training_unit(unit_id: int, tenant: TenantContext = Depends(get_tenan
|
||||
cur = get_cursor(conn)
|
||||
|
||||
cur.execute(
|
||||
"SELECT created_by, framework_slot_id FROM training_units WHERE id = %s",
|
||||
"""
|
||||
SELECT tu.created_by, tu.framework_slot_id, tg.club_id AS group_club_id
|
||||
FROM training_units tu
|
||||
LEFT JOIN training_groups tg ON tu.group_id = tg.id
|
||||
WHERE tu.id = %s
|
||||
""",
|
||||
(unit_id,),
|
||||
)
|
||||
|
||||
@@ -1444,7 +1479,13 @@ def delete_training_unit(unit_id: int, tenant: TenantContext = Depends(get_tenan
|
||||
detail="Blueprint-Einheiten werden über das Rahmenprogramm verwaltet, nicht hier gelöscht.",
|
||||
)
|
||||
|
||||
_assert_delete_training_unit(role, unit["created_by"], profile_id)
|
||||
_assert_delete_training_unit(
|
||||
cur,
|
||||
role,
|
||||
unit["created_by"],
|
||||
profile_id,
|
||||
unit.get("group_club_id"),
|
||||
)
|
||||
|
||||
cur.execute("DELETE FROM training_units WHERE id = %s", (unit_id,))
|
||||
conn.commit()
|
||||
|
||||
+10
-2
@@ -1,7 +1,7 @@
|
||||
# Shinkan Jinkendo Version Information
|
||||
|
||||
APP_VERSION = "0.8.37"
|
||||
BUILD_DATE = "2026-05-05"
|
||||
APP_VERSION = "0.8.38"
|
||||
BUILD_DATE = "2026-05-06"
|
||||
DB_SCHEMA_VERSION = "20260505042"
|
||||
|
||||
MODULE_VERSIONS = {
|
||||
@@ -27,6 +27,14 @@ MODULE_VERSIONS = {
|
||||
}
|
||||
|
||||
CHANGELOG = [
|
||||
{
|
||||
"version": "0.8.38",
|
||||
"date": "2026-05-06",
|
||||
"changes": [
|
||||
"Trainingsplanung: Vereinsadmins sehen alle Einheiten bei club_id-/Gruppenliste; GET/PUT Einheit & Löschen mit can_manage_club_org",
|
||||
"Planung UI: „Trainer zuweisen“ in Vereins-Ansicht (Liste + Kalender) + eigener Modal; Mitgliederverzeichnis für Vereinsorganisation",
|
||||
],
|
||||
},
|
||||
{
|
||||
"version": "0.8.37",
|
||||
"date": "2026-05-05",
|
||||
|
||||
Reference in new issue
Block a user