feat(rbac-ui): add academic management to bedelia rbac, restyle role menus, display version badges, and fix classrooms template
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user