feat(turnero): bacteriólogo sin dashboard/historial, redirige por IP
- Auth: agrega isBacteriologo() - App: guard que bloquea dashboard e historial para bacteriólogo y redirige según IP (turnero_dispositivos); IP registrada → ese lugar, IP libre → primer lugar de muestras - module.php: sidebar bacteriólogo sin Dashboard/Historial; IP registrada muestra solo ese lugar, IP libre muestra TV + todos los lugares muestras Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a776c5733c
commit
b2e7130762
+32
-10
@@ -44,17 +44,39 @@ if ($_trIsRecep) {
|
||||
$_trLinks[] = ['name' => 'Recepción', 'icon' => 'fas fa-concierge-bell', 'route' => '/erp.php?m=turnero&v=recepcion'];
|
||||
}
|
||||
|
||||
// ── Bacteriólogo: dashboard, historial, TV + sus estaciones ──
|
||||
// ── Bacteriólogo: sin dashboard ni historial; vista según IP ──
|
||||
} elseif ($_trIsBacte) {
|
||||
$_trLinks[] = ['name' => 'Dashboard', 'icon' => 'fas fa-tachometer-alt', 'route' => '/erp.php?m=turnero&v=dashboard'];
|
||||
$_trLinks[] = ['name' => 'Historial', 'icon' => 'fas fa-history', 'route' => '/erp.php?m=turnero&v=historial'];
|
||||
$_trLinks[] = ['name' => 'Pantalla TV', 'icon' => 'fas fa-tv', 'route' => '/erp.php?m=turnero&v=display_global'];
|
||||
foreach ($_trMuestras as $_m) {
|
||||
$_trLinks[] = [
|
||||
'name' => $_m['nombre'],
|
||||
'icon' => 'fas fa-flask',
|
||||
'route' => '/erp.php?m=turnero&v=lugar&lugar_id=' . (int)$_m['id'],
|
||||
];
|
||||
$_trIpLugar = null;
|
||||
try {
|
||||
$_trIpRow = $_trPdo->prepare(
|
||||
"SELECT lugar_id FROM turnero_dispositivos WHERE ip = ? AND activo = 1 LIMIT 1"
|
||||
);
|
||||
$_trIpRow->execute([$_SERVER['REMOTE_ADDR'] ?? '']);
|
||||
$_trIpLugar = $_trIpRow->fetchColumn() ?: null;
|
||||
} catch (\Throwable $_) {}
|
||||
|
||||
if ($_trIpLugar) {
|
||||
// IP registrada: solo ese lugar en el sidebar
|
||||
foreach ($_trMuestras as $_m) {
|
||||
if ((int)$_m['id'] === (int)$_trIpLugar) {
|
||||
$_trLinks[] = [
|
||||
'name' => $_m['nombre'],
|
||||
'icon' => 'fas fa-flask',
|
||||
'route' => '/erp.php?m=turnero&v=lugar&lugar_id=' . (int)$_m['id'],
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// IP no registrada: TV + todos los lugares muestras
|
||||
$_trLinks[] = ['name' => 'Pantalla TV', 'icon' => 'fas fa-tv', 'route' => '/erp.php?m=turnero&v=display_global'];
|
||||
foreach ($_trMuestras as $_m) {
|
||||
$_trLinks[] = [
|
||||
'name' => $_m['nombre'],
|
||||
'icon' => 'fas fa-flask',
|
||||
'route' => '/erp.php?m=turnero&v=lugar&lugar_id=' . (int)$_m['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// ── Admin / Supervisor / otros: acceso completo ───────────────
|
||||
|
||||
Reference in New Issue
Block a user