diff --git a/app/routes/genetic_algorithm.py b/app/routes/genetic_algorithm.py index cfa1848..9d09e5b 100644 --- a/app/routes/genetic_algorithm.py +++ b/app/routes/genetic_algorithm.py @@ -249,7 +249,7 @@ genetic_web_bp = Blueprint('genetic_algorithm_web', __name__) @login_required def genetic_optimizer(): """Render the genetic algorithm optimizer interface""" - if current_user.role not in ['ADMIN']: + if not (current_user.has_permission('optimizer', 'read') or (current_user.role and current_user.role.upper() == 'ADMIN')): return render_template('auth/403.html'), 403 return render_template('genetic_optimizer.html') \ No newline at end of file diff --git a/app/routes/main.py b/app/routes/main.py index 9b4af9b..8f64b91 100644 --- a/app/routes/main.py +++ b/app/routes/main.py @@ -113,8 +113,8 @@ def dashboard_stats_api(): @login_required def genetic_optimizer(): """Serve the genetic algorithm optimization interface""" - if current_user.role not in ['ADMIN']: - flash('You do not have permission to access the optimization tool.', 'danger') + if not (current_user.has_permission('optimizer', 'read') or (current_user.role and current_user.role.upper() == 'ADMIN')): + flash(_('No tienes permisos para acceder a la herramienta de optimización.'), 'danger') return redirect(url_for('main.dashboard')) return render_template('genetic_optimizer.html') diff --git a/app/templates/base.html b/app/templates/base.html index 0f47fa1..cc6fa38 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -90,6 +90,12 @@
  • {% trans %}Today's Schedule{% endtrans %}
  • + {% if current_user.has_permission('optimizer', 'read') or (current_user.role and current_user.role|upper == 'ADMIN') %} +
  • +
  • + {% trans %}Optimizador de Aulas (IA){% endtrans %} +
  • + {% endif %} {% if current_user.is_authenticated and current_user.can_manage() %} diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index fb6d3e7..2b8543d 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -141,6 +141,11 @@ {% trans %}Cartelera del Día{% endtrans %} + {% if current_user.has_permission('optimizer', 'read') or (current_user.role and current_user.role|upper == 'ADMIN') %} + + {% trans %}Optimizador de Aulas (IA){% endtrans %} + + {% endif %} {% trans %}Listado de Aulas{% endtrans %}