fix: página de inicio coherente con cada rol al iniciar sesión
BD: home_page asignado a roles que lo tenían NULL: - recepcionista → /erp.php?m=turnero&v=recepcion - supervisor → /lab_dashboard.php - operador_bot → /index.php - readonly → /lab_ordenes.php login.php: fallback mejorado por módulos cuando home_page no aplica (turnero → recepcion, lab_dashboard → dashboard, etc.) index.php: redirige recepcionistas y roles sin whatsapp a su página correcta si por algún motivo llegan al panel de WhatsApp. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
0f07ee22c7
commit
ea0de4d487
@@ -13,10 +13,17 @@ if (!isUserLoggedIn()) {
|
||||
exit('Acceso denegado. <a href="login.php">Iniciar sesión</a>');
|
||||
}
|
||||
|
||||
// Enfermeros no tienen acceso al panel principal
|
||||
// Redirigir roles que no deben ver el panel WhatsApp
|
||||
if (isEnfermero()) {
|
||||
header('Location: enfermero_portal.php');
|
||||
exit;
|
||||
header('Location: enfermero_portal.php'); exit;
|
||||
}
|
||||
$_indexRole = $_SESSION['admin_user']['role'] ?? '';
|
||||
$_indexModules = $_SESSION['admin_user']['modules'] ?? [];
|
||||
if ($_indexRole === 'recepcionista' || (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true))) {
|
||||
header('Location: erp.php?m=turnero&v=recepcion'); exit;
|
||||
}
|
||||
if (in_array('lab_dashboard', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) {
|
||||
header('Location: lab_dashboard.php'); exit;
|
||||
}
|
||||
|
||||
// Verificar conexión a la base de datos
|
||||
|
||||
@@ -53,12 +53,16 @@ if ($_POST && !$loginBlocked) {
|
||||
}
|
||||
if ($roleSlug === 'enfermero') {
|
||||
header('Location: enfermero_portal.php');
|
||||
} elseif (count($modules) === 1 && $modules[0] === 'lab_formularios') {
|
||||
} elseif (in_array('turnero', $modules, true)) {
|
||||
header('Location: erp.php?m=turnero&v=recepcion');
|
||||
} elseif (in_array('lab_dashboard', $modules, true)) {
|
||||
header('Location: lab_dashboard.php');
|
||||
} elseif (in_array('lab_formularios', $modules, true)) {
|
||||
header('Location: lab_formularios.php');
|
||||
} elseif (count($modules) === 2
|
||||
&& in_array('lab_domicilios', $modules, true)
|
||||
&& in_array('lab_ordenes', $modules, true)) {
|
||||
header('Location: lab_domicilios.php');
|
||||
} elseif (in_array('lab_ordenes', $modules, true)) {
|
||||
header('Location: lab_ordenes.php');
|
||||
} elseif (in_array('whatsapp', $modules, true)) {
|
||||
header('Location: index.php');
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user