Fix type comparison in vehicle deletion logic

Ensure correct comparison between customer ID and user number by explicitly casting both to integers. This prevents potential logical errors when checking permissions for vehicle deletion.
This commit is contained in:
Jepp9350
2025-04-09 15:55:31 +02:00
parent 400054f0ea
commit 3ad09e9367
+1 -1
View File
@@ -249,7 +249,7 @@ class vehiclesRoute
$response->error('Vehicle not found', 404);
}
// Check if the user is allowed to delete the vehicle
if ($vehicle->customer_id->value() !== (int)$user->customer_number->value()) {
if ((int)$vehicle->customer_id->value() !== (int)$user->customer_number->value()) {
// Check if the user has permission to delete other users vehicles
if (!$user->hasPermission('delete_vehicle_other')) {
// Log the incident