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
========================================== */
$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)