fix(security): remove daily limit edit pencil from student view, hide parent button for students, and enforce read-only student permissions
This commit is contained in:
+2
-3
@@ -301,12 +301,11 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- BANNER DE LÍMITE DIARIO Y SALUD (TOCABLE PARA EDITAR) -->
|
||||
<div class="daily-limit-badge" id="dailyLimitBadge" onclick="openDailyLimitEditor()" style="cursor: pointer;" title="Toca aquí para escribir o ajustar el límite diario">
|
||||
<!-- BANNER DE LÍMITE DIARIO Y DISPONIBILIDAD (SÓLO LECTURA INFORMATIVA PARA EL ESTUDIANTE) -->
|
||||
<div class="daily-limit-badge" id="dailyLimitBadge" style="cursor: default;" title="Límite diario establecido por tus padres">
|
||||
<div>
|
||||
<span>Límite diario fijado: </span>
|
||||
<strong id="dailyLimitText">₡0</strong>
|
||||
<span style="font-size: 0.72rem; color: #0284c7; background: #e0f2fe; padding: 2px 7px; border-radius: 6px; margin-left: 6px; font-weight: 800;">✏️ Cambiar</span>
|
||||
</div>
|
||||
<div style="font-size: 0.76rem; color: var(--text-muted);" id="dailyAvailableText">
|
||||
Disponible hoy: ₡0
|
||||
|
||||
+20
-2
@@ -173,14 +173,21 @@ async function applyUserRoleSession() {
|
||||
if (viewAdmin) viewAdmin.style.display = 'none';
|
||||
if (appContainer) appContainer.style.display = 'block';
|
||||
|
||||
// Mostrar botón de acceso al portal de padres
|
||||
const btnPadres = document.getElementById('btnModePadres');
|
||||
if (btnPadres) btnPadres.style.display = 'inline-block';
|
||||
|
||||
await loadInitialData();
|
||||
setupParentPortalChildren();
|
||||
toggleParentPanel(true);
|
||||
} else {
|
||||
// Estudiante
|
||||
// Estudiante: SEGURIDAD ESTRICTA - Ocultar botón de padres
|
||||
if (viewAdmin) viewAdmin.style.display = 'none';
|
||||
if (appContainer) appContainer.style.display = 'block';
|
||||
|
||||
const btnPadres = document.getElementById('btnModePadres');
|
||||
if (btnPadres) btnPadres.style.display = 'none';
|
||||
|
||||
await loadInitialData();
|
||||
if (currentUser.estudiante) {
|
||||
await selectStudent(currentUser.estudiante.id);
|
||||
@@ -600,11 +607,22 @@ function closeQrModal(e) {
|
||||
// ==========================================
|
||||
|
||||
function toggleParentPanel(show, e) {
|
||||
// SEGURIDAD: Un estudiante no tiene acceso al portal de padres
|
||||
if (currentUser && currentUser.rol === 'estudiante') {
|
||||
const modalPadres = document.getElementById('modalPadres');
|
||||
if (modalPadres) modalPadres.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
if (e && e.target !== e.currentTarget) return;
|
||||
document.getElementById('modalPadres').style.display = show ? 'flex' : 'none';
|
||||
const modalPadres = document.getElementById('modalPadres');
|
||||
if (modalPadres) modalPadres.style.display = show ? 'flex' : 'none';
|
||||
}
|
||||
|
||||
function openDailyLimitEditor() {
|
||||
// SEGURIDAD: Los estudiantes no pueden modificar su límite diario
|
||||
if (!currentUser || currentUser.rol === 'estudiante') {
|
||||
return;
|
||||
}
|
||||
toggleParentPanel(true);
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('inputCustomDailyLimit');
|
||||
|
||||
Reference in New Issue
Block a user