feat(biometrics): enforce strict branch scoping on biometric attendance and sync
- Restrict biometric attendances query and grouped records strictly to employees of assigned branch - Scope bulk sync (syncAll) to only sync biometric records for employees within the user's branch - Guard individual sync and custom sync against processing employees from foreign branches - Tighten attendance records query to strictly filter by employee assigned branch - Add feature test verifying biometric attendance isolation and permission guards
This commit is contained in:
@@ -46,11 +46,8 @@ class AttendanceRecordController extends Controller
|
||||
->where(function ($q) use ($scopedBranchId) {
|
||||
if ($scopedBranchId) {
|
||||
$q->whereIn('created_by', getCompanyAndUsersId())
|
||||
->where(function ($subQ) use ($scopedBranchId) {
|
||||
$subQ->where('attendance_records.branch_id', $scopedBranchId)
|
||||
->orWhereHas('employee.employee', function ($eq) use ($scopedBranchId) {
|
||||
$eq->where('branch_id', $scopedBranchId);
|
||||
});
|
||||
->whereHas('employee.employee', function ($eq) use ($scopedBranchId) {
|
||||
$eq->where('branch_id', $scopedBranchId);
|
||||
});
|
||||
} elseif (Auth::user()->can('manage-any-attendance-records')) {
|
||||
$q->whereIn('created_by', getCompanyAndUsersId());
|
||||
|
||||
Reference in New Issue
Block a user