From fc94ca82fe9a43f39f2ae93f9224b91fcb6a4777 Mon Sep 17 00:00:00 2001 From: Carlos Tello Date: Wed, 7 Oct 2026 17:16:11 -0300 Subject: [PATCH] feat(rbac-ui): add academic management to bedelia rbac, restyle role menus, display version badges, and fix classrooms template --- CHANGELOG.md | 8 + backend/app/__init__.py | 1 + backend/app/routes/api/openapi.py | 19 +- backend/setup.py | 2 +- frontend/package.json | 2 +- frontend/src/app.js | 22 ++ frontend/src/middlewares/authMiddleware.js | 14 +- frontend/views/auth/login.html | 5 + frontend/views/base.html | 256 +++++++++++++-------- frontend/views/classrooms/list.html | 70 +++--- 10 files changed, 264 insertions(+), 135 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12e2dd3..1b924e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,14 @@ El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1 7. **Asociar Profesores (`/admin/commission_detail`):** Asignación del cuerpo docente y co-docentes con roles de cátedra. 8. **Asociar Alumnos (`/admin/commission_detail`):** Matriculación con validación de restricciones horarias y excepciones de Bedelía. 9. **Reserva de Espacios (`/schedule/add_reservation` o Drag & Drop en `/schedule/calendar_view`):** Asignación de aula y franja horaria en 1 clic con chequeo de conflictos. +- **Gestión Académica en RBAC y Reestructuración de Menús UX/UI:** + - Ampliación de permisos RBAC para rol **Bedelía** permitiendo la administración total de ciclos lectivos, carreras, materias, comisiones, docentes, alumnos y reservas. + - Reorganización de la barra lateral de navegación según las mejores prácticas de IT y arquitectura de la información: menús especializados y directos para **Administrador**, **Bedelía**, **Docente** y **Alumno**. +- **Control y Exposición de Versiones Institucionales (v3.3.0):** + - Estandarización de número de versión en Backend (`__version__ = "3.3.0"`, `/api/v1/version`, `/api/v1/health`) y Frontend BFF (`package.json`, `/version`). + - Badges de versión visibles y legibles en el pie del menú lateral (`sidebar-footer`) y en la pantalla de inicio de sesión (`login.html`). +- **Corrección de Error en Catálogo de Aulas (`/classrooms/list_classrooms`):** + - Resolución del error 500 (`Template render error: unknown block tag: endblock`) balanceando los bloques condicionales de Nunjucks entre los modos presencial y virtual. - **Alineamiento de Documentación con SSD (Software System Design):** - **Constitución del Sistema (`docs/constitution.md`):** Actualización con principios innegociables: arquitectura desacoplada REST + BFF, reemplazo definitivo del Excel, matriz de conflictos, caché de Moodle 4.1, y RBAC seguro. - **Manual de Agentes (`AGENTS.md`):** Definición precisa del stack, comandos de desarrollo y pruebas, convenciones y límites. diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 32501a9..a1204b9 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -6,6 +6,7 @@ from flask_babel import Babel, gettext as _ from config.config import Config # Initialize extensions +__version__ = "3.3.0" db = SQLAlchemy() migrate = Migrate() cors = CORS() diff --git a/backend/app/routes/api/openapi.py b/backend/app/routes/api/openapi.py index b54c2bb..6d2a190 100644 --- a/backend/app/routes/api/openapi.py +++ b/backend/app/routes/api/openapi.py @@ -7,7 +7,7 @@ OPENAPI_SPEC = { "info": { "title": "Edu-Space REST API", "description": "Enterprise Academic & Physical Space Management REST API with JWT Authentication and Role-Based Access Control.", - "version": "1.0.0" + "version": "3.3.0" }, "servers": [ { @@ -240,3 +240,20 @@ OPENAPI_SPEC = { def get_openapi_spec(): """Serves the OpenAPI 3.0 specification for Schemathesis / DAST and Swagger UI.""" return jsonify(OPENAPI_SPEC) + +@api_openapi_bp.route('/version', methods=['GET']) +def get_api_version(): + """Returns the backend API version information.""" + return jsonify({ + "name": "Edu-Space REST API", + "version": "3.3.0", + "status": "healthy" + }), 200 + +@api_openapi_bp.route('/health', methods=['GET']) +def get_api_health(): + """Liveness probe for backend API.""" + return jsonify({ + "status": "ok", + "version": "3.3.0" + }), 200 diff --git a/backend/setup.py b/backend/setup.py index 8a2bd70..39d9394 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="edu-space-admin", - version="1.0.0", + version="3.3.0", description="Administrative interface for Edu-Space Classroom Management System", author="Edu-Space Development Team", author_email="admin@edu-space.com", diff --git a/frontend/package.json b/frontend/package.json index 03a784b..f380462 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "1.0.0", + "version": "3.3.0", "description": "", "main": "index.js", "scripts": { diff --git a/frontend/src/app.js b/frontend/src/app.js index aa41aef..b84c691 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -84,6 +84,15 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), { watch: process.env.NODE_ENV !== 'production' }); +// Versiones institucionales del sistema +const APP_VERSION = '3.3.0'; +const FRONTEND_VERSION = '3.3.0'; +const BACKEND_VERSION = '3.3.0'; + +env.addGlobal('app_version', APP_VERSION); +env.addGlobal('frontend_version', FRONTEND_VERSION); +env.addGlobal('backend_version', BACKEND_VERSION); + // Nunjucks custom filters/helpers env.addFilter('get', function(obj, key, defaultVal) { if (!obj) return defaultVal; @@ -222,9 +231,22 @@ app.use((req, res, next) => { res.locals.impersonated_user = impersonatedUser; res.locals.session = { get: (k, d) => d }; res.locals.occupancy_metrics = { get: (k, d) => d }; + res.locals.app_version = APP_VERSION; + res.locals.frontend_version = FRONTEND_VERSION; + res.locals.backend_version = BACKEND_VERSION; next(); }); +// Endpoint público de verificación de versiones +app.get('/version', (req, res) => { + res.json({ + app: APP_VERSION, + frontend: FRONTEND_VERSION, + backend: BACKEND_VERSION, + status: 'ok' + }); +}); + // Rutas Principales const indexRoutes = require('./routes/index'); const authRoutes = require('./routes/auth'); diff --git a/frontend/src/middlewares/authMiddleware.js b/frontend/src/middlewares/authMiddleware.js index a6e028c..4bf3bc2 100644 --- a/frontend/src/middlewares/authMiddleware.js +++ b/frontend/src/middlewares/authMiddleware.js @@ -44,18 +44,22 @@ const buildUserSession = (decoded) => { has_permission: (module, action) => { if (isAdmin) return true; if (isBedelia) { - if (module === 'reservations' || module === 'classrooms' || module === 'schedule') return true; - if (module === 'academic' && action === 'read') return true; + if ([ + 'reservations', 'classrooms', 'schedule', 'academic', + 'enrollment', 'subjects', 'careers', 'commissions', + 'buildings', 'import', 'milestone_types', 'metrics' + ].includes(module)) return true; } if (isDocente) { - if (module === 'my_subjects' || module === 'academic') return true; - if (module === 'reservations' && action === 'read') return true; + if (['my_subjects', 'academic', 'gradebook'].includes(module)) return true; + if ((module === 'reservations' || module === 'schedule') && action === 'read') return true; } if (isAlumno) { - if (module === 'my_subjects' && action === 'read') return true; + if (['my_subjects', 'schedule', 'grades'].includes(module)) return true; } return false; }, + can_manage_academic: () => canManage, can_edit_reservation: (res) => { if (isAdmin || isBedelia) return true; if (isDocente && res && (res.user_id === decoded?.sub || res.user?.id === decoded?.sub)) return true; diff --git a/frontend/views/auth/login.html b/frontend/views/auth/login.html index f1b5e56..71dc8b3 100644 --- a/frontend/views/auth/login.html +++ b/frontend/views/auth/login.html @@ -223,6 +223,11 @@ Acceso institucional seguro • Actividad auditada +
+ + v{{ app_version or '3.3.0' }} (FE: {{ frontend_version or '3.3.0' }} | BE: {{ backend_version or '3.3.0' }}) + +
diff --git a/frontend/views/base.html b/frontend/views/base.html index a2f3b62..f23c5fa 100644 --- a/frontend/views/base.html +++ b/frontend/views/base.html @@ -900,97 +900,32 @@ @@ -1060,6 +1124,12 @@
  • Cerrar Sesión
  • + + diff --git a/frontend/views/classrooms/list.html b/frontend/views/classrooms/list.html index d321d95..a4b667e 100644 --- a/frontend/views/classrooms/list.html +++ b/frontend/views/classrooms/list.html @@ -593,6 +593,42 @@ {% endif %} + +{% if classrooms and classrooms.items and (classrooms.items|length > 0) %} +{% for classroom in classrooms.items %} + +{% endfor %} +{% endif %} + @@ -1007,40 +1043,6 @@ {% endif %} - -{% if classrooms and classrooms.items and (classrooms.items|length > 0) %} -{% for classroom in classrooms.items %} - -{% endfor %} {% endif %}