From d5094bff010c7c93bbe36722ebb4a1652dc8f5bb Mon Sep 17 00:00:00 2001 From: solocla Date: Fri, 23 Oct 2026 17:27:42 +0200 Subject: [PATCH] fixed employees permission --- public/userarea/employee-profile.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/userarea/employee-profile.php b/public/userarea/employee-profile.php index 7115dd36..52e6823a 100644 --- a/public/userarea/employee-profile.php +++ b/public/userarea/employee-profile.php @@ -6,10 +6,11 @@ $pdo = DBHandlerSelect::getInstance()->getConnection(); /* ========================================== PERMISSIONS ========================================== */ -$isHrManager = Auth::user()->hasRole('Admin') - || Auth::user()->hasRole('Superuser') - || Auth::user()->hasRole('employee-hr') - || Auth::user()->hasRole('manager'); +$canEdit = userCan('hr.employee_profiles.edit'); +$canViewOthers = $canEdit || userCan('hr.employee_profiles.view'); + +// Compatibilità con il resto della pagina (pulsante "Torna ai Dipendenti" ecc.) +$isHrManager = $canViewOthers; /* ========================================== RESOLVE TARGET EMPLOYEE @@ -67,7 +68,7 @@ if (!$isHrManager && $employee && (int)$employee['auth_user_id'] !== (int)$iduse exit; } -$canEdit = $isHrManager; + /* ========================================== EMPLOYEE JOB ROLES / SUB ROLES (multi assignment)