fixed employees permission

This commit is contained in:
2026-10-23 17:27:42 +02:00
parent a499e7acbd
commit d5094bff01
+6 -5
View File
@@ -6,10 +6,11 @@ $pdo = DBHandlerSelect::getInstance()->getConnection();
/* ========================================== /* ==========================================
PERMISSIONS PERMISSIONS
========================================== */ ========================================== */
$isHrManager = Auth::user()->hasRole('Admin') $canEdit = userCan('hr.employee_profiles.edit');
|| Auth::user()->hasRole('Superuser') $canViewOthers = $canEdit || userCan('hr.employee_profiles.view');
|| Auth::user()->hasRole('employee-hr')
|| Auth::user()->hasRole('manager'); // Compatibilità con il resto della pagina (pulsante "Torna ai Dipendenti" ecc.)
$isHrManager = $canViewOthers;
/* ========================================== /* ==========================================
RESOLVE TARGET EMPLOYEE RESOLVE TARGET EMPLOYEE
@@ -67,7 +68,7 @@ if (!$isHrManager && $employee && (int)$employee['auth_user_id'] !== (int)$iduse
exit; exit;
} }
$canEdit = $isHrManager;
/* ========================================== /* ==========================================
EMPLOYEE JOB ROLES / SUB ROLES (multi assignment) EMPLOYEE JOB ROLES / SUB ROLES (multi assignment)