feat: enhance governance visibility checks and update login rate limit
- Updated governance visibility logic in `assert_valid_governance_visibility` to enforce club membership checks for platform admins and ensure proper club existence validation. - Increased login request limit from 5 to 30 per minute to improve user experience. - Refactored exercise update logic to better handle visibility and club ID requirements, ensuring compliance with governance rules.
This commit is contained in:
1 parent
0181575962
commit
870a7611dc
5 files changed
+64
-18
No files matched your search
@@ -108,7 +108,7 @@ def assert_valid_governance_visibility(
|
||||
visibility: str,
|
||||
club_id: Optional[int],
|
||||
) -> None:
|
||||
"""Pflicht club_id bei visibility=club + Mitgliedschaft; official nur Plattform-Admin."""
|
||||
"""Pflicht club_id bei visibility=club; Mitgliedschaft außer Plattform-Admin; official nur Plattform-Admin."""
|
||||
if visibility not in _GOVERNANCE_VISIBILITY:
|
||||
raise HTTPException(status_code=400, detail="Ungültige visibility")
|
||||
if visibility == "official" and not is_platform_admin(role):
|
||||
@@ -119,7 +119,12 @@ def assert_valid_governance_visibility(
|
||||
if visibility == "club":
|
||||
if club_id is None:
|
||||
raise HTTPException(status_code=400, detail="club_id ist bei visibility=club erforderlich")
|
||||
assert_club_member(cur, profile_id, club_id)
|
||||
if is_platform_admin(role):
|
||||
cur.execute("SELECT 1 FROM clubs WHERE id = %s", (club_id,))
|
||||
if not cur.fetchone():
|
||||
raise HTTPException(status_code=400, detail="Verein nicht gefunden")
|
||||
else:
|
||||
assert_club_member(cur, profile_id, club_id)
|
||||
|
||||
|
||||
def exercise_visible_to_profile(
|
||||
|
||||
Reference in new issue
Block a user