fix(auth): redirigir admins/supervisores al dashboard del turnero tras login
login.php y index.php enviaban a v=recepcion a cualquier usuario con el módulo turnero que no fuera bacteriólogo, incluyendo superadmin, admin y supervisor. Esto causaba que al cerrar sesión y volver a entrar, el admin aterrizaba en recepción en vez del dashboard. Ahora: - bacteriologo → lugar_id=1 - superadmin/admin/supervisor → v=dashboard - recepcionista/otros → v=recepcion (comportamiento previo correcto) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
925b29b00b
commit
fa591873a9
@@ -19,9 +19,16 @@ if (isEnfermero()) {
|
|||||||
}
|
}
|
||||||
$_indexRole = $_SESSION['admin_user']['role'] ?? '';
|
$_indexRole = $_SESSION['admin_user']['role'] ?? '';
|
||||||
$_indexModules = $_SESSION['admin_user']['modules'] ?? [];
|
$_indexModules = $_SESSION['admin_user']['modules'] ?? [];
|
||||||
if ($_indexRole === 'recepcionista' || (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true))) {
|
if ($_indexRole === 'recepcionista') {
|
||||||
header('Location: erp.php?m=turnero&v=recepcion'); exit;
|
header('Location: erp.php?m=turnero&v=recepcion'); exit;
|
||||||
}
|
}
|
||||||
|
if (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) {
|
||||||
|
$_indexAdminRoles = ['superadmin', 'admin', 'supervisor'];
|
||||||
|
$url = in_array($_indexRole, $_indexAdminRoles, true)
|
||||||
|
? 'erp.php?m=turnero&v=dashboard'
|
||||||
|
: 'erp.php?m=turnero&v=recepcion';
|
||||||
|
header('Location: ' . $url); exit;
|
||||||
|
}
|
||||||
if (in_array('lab_dashboard', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) {
|
if (in_array('lab_dashboard', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) {
|
||||||
header('Location: lab_dashboard.php'); exit;
|
header('Location: lab_dashboard.php'); exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ if ($_POST && !$loginBlocked) {
|
|||||||
} elseif (in_array('turnero', $modules, true)) {
|
} elseif (in_array('turnero', $modules, true)) {
|
||||||
if ($roleSlug === 'bacteriologo') {
|
if ($roleSlug === 'bacteriologo') {
|
||||||
header('Location: erp.php?m=turnero&v=lugar&lugar_id=1');
|
header('Location: erp.php?m=turnero&v=lugar&lugar_id=1');
|
||||||
|
} elseif (in_array($roleSlug, ['superadmin', 'admin', 'supervisor'], true)) {
|
||||||
|
header('Location: erp.php?m=turnero&v=dashboard');
|
||||||
} else {
|
} else {
|
||||||
header('Location: erp.php?m=turnero&v=recepcion');
|
header('Location: erp.php?m=turnero&v=recepcion');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user