Correction des présences et correction de plusieurs erreurs mineur de déplacement/parcours de l'utilisateur, harmonisation des processus

This commit is contained in:
cedrick2711
2026-07-28 18:11:02 -04:00
parent b982cd0318
commit a0f18a886c
19 changed files with 250 additions and 116 deletions
+13 -13
View File
@@ -69,7 +69,7 @@ def list_users():
Returns:
Response: Rendered users list template or redirect to dashboard.
"""
if current_user.role != 'president':
if current_user.role != 'admin':
flash('Only the president can manage users.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -91,7 +91,7 @@ def edit_user(user_id):
Returns:
Response: Edit form or redirect to users list.
"""
if current_user.role != 'president':
if current_user.role != 'admin':
flash('Only the president can edit users.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -149,7 +149,7 @@ def delete_user(user_id):
Returns:
Response: Redirect to users list with status message.
"""
if current_user.role != 'president':
if current_user.role != 'admin':
flash('Only the president can delete users.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -229,7 +229,7 @@ def create_user():
Returns:
Response: Create form or redirect to users list.
"""
if current_user.role != 'president':
if current_user.role != 'admin':
flash('Only the president can create users.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -588,7 +588,7 @@ def can_manage_player_contract(user, player_id):
bool: True if user has permission to manage the contract.
"""
# President can manage all contracts
if user.role == 'president':
if user.role == 'admin':
return True
# Manager can upload contracts for any player
@@ -621,7 +621,7 @@ def list_contracts():
if current_user.role == 'player':
# Players see their own contracts
contracts = Contract.query.filter_by(player_id=current_user.id).order_by(Contract.uploaded_at.desc()).all()
elif current_user.role in ['president', 'manager', 'coach']:
elif current_user.role in ['admin', 'manager', 'coach']:
# Superiors see contracts for players on their teams
players = []
if current_user.role == 'coach':
@@ -636,7 +636,7 @@ def list_contracts():
player_ids = [p.id for p in players]
contracts = Contract.query.filter(Contract.player_id.in_(player_ids)).order_by(Contract.uploaded_at.desc()).all()
return render_template('pages/contracts.html', contracts=contracts, players=players if current_user.role in ['president', 'manager', 'coach'] else None)
return render_template('pages/contracts.html', contracts=contracts, players=players if current_user.role in ['admin', 'manager', 'coach'] else None)
@users_bp.route('/contracts/upload', methods=['GET', 'POST'])
@@ -650,7 +650,7 @@ def upload_contract():
Returns:
Response: Upload form or redirect to contracts list.
"""
if current_user.role not in ['president', 'manager', 'coach']:
if current_user.role not in ['admin', 'manager', 'coach']:
flash('Only presidents, managers, and coaches can upload contracts.', 'danger')
return redirect(url_for('users.list_contracts'))
@@ -1395,7 +1395,7 @@ def add_personal_note():
Returns:
Response: Create form or redirect to notes view.
"""
if current_user.role not in ['coach', 'manager', 'president']:
if current_user.role not in ['coach', 'manager', 'admin']:
flash('Only coaches and managers can add notes.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -1407,7 +1407,7 @@ def add_personal_note():
if org_team:
player_ids = [tp.player_id for tp in TeamPlayer.query.filter_by(org_team_id=org_team.id).all()]
players = User.query.filter(User.id.in_(player_ids)).order_by(User.username).all() if player_ids else []
elif current_user.role in ['president', 'manager']:
elif current_user.role in ['admin', 'manager']:
players = User.query.filter_by(role='player').order_by(User.username).all()
# Get available matches and tryouts for context
@@ -1417,7 +1417,7 @@ def add_personal_note():
if current_user.role == 'coach' and org_team:
tryouts = Tryout.query.filter_by(target_org_team_id=org_team.id).order_by(Tryout.date.desc()).all()
matches = Match.query.join(Tryout).filter(Tryout.target_org_team_id == org_team.id).order_by(Match.date.desc()).all()
elif current_user.role in ['president', 'manager']:
elif current_user.role in ['admin', 'manager']:
tryouts = Tryout.query.order_by(Tryout.date.desc()).all()
matches = Match.query.order_by(Match.date.desc()).all()
teams = Team.query.order_by(Team.name).all()
@@ -1501,7 +1501,7 @@ def add_note_from_match(match_id):
Returns:
Response: Create form or redirect.
"""
if current_user.role not in ['coach', 'manager', 'president']:
if current_user.role not in ['coach', 'manager', 'admin']:
flash('Only coaches can add notes from matches.', 'danger')
return redirect(url_for('main.dashboard'))
@@ -1577,7 +1577,7 @@ def add_note_from_tryout(tryout_id):
Returns:
Response: Create form or redirect.
"""
if current_user.role not in ['coach', 'manager', 'president']:
if current_user.role not in ['coach', 'manager', 'admin']:
flash('Only coaches can add notes from tryouts.', 'danger')
return redirect(url_for('main.dashboard'))