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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user