From 4bf9d99f8ba37023bb9fab267de867119dbd0bc8 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 21 Apr 2026 16:07:30 -0500 Subject: [PATCH] Update _helpers.php --- api/lab/_helpers.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/lab/_helpers.php b/api/lab/_helpers.php index 8346132..038501b 100644 --- a/api/lab/_helpers.php +++ b/api/lab/_helpers.php @@ -65,10 +65,11 @@ function userRole(): string { } /** - * Detiene la ejecución con 403 JSON si el usuario no es admin (bloquea enfermeros). + * Detiene la ejecución con 403 JSON si el usuario no es admin ni superadmin. */ function requireAdmin(): void { - if (userRole() !== 'admin') { + $role = userRole(); + if (!in_array($role, ['admin', 'superadmin'], true)) { jsonError('Acceso restringido a administradores', 403); } }