Merge pull request #198 from copenhagentruckwash/fix-lane-ownership-validation-for-commands
Enforce department scoping for self-serve lane command route
This commit is contained in:
@@ -459,6 +459,11 @@ class moduleSelfServeRoute
|
||||
self::requireType($commandParam, self::type_string());
|
||||
// Get the lane and command
|
||||
$lane = $selfserve->lane($lane_id);
|
||||
// Require access to the lane's department to prevent cross-department command execution
|
||||
if (empty($lane->department_lane) || empty($lane->department_lane->department)) {
|
||||
$response->error('Lane department not found', 404);
|
||||
}
|
||||
self::requireDepartmentAccess((string)$lane->department_lane->department->value());
|
||||
// If the user has the bypass permission, set the lane to bypass customer number validation
|
||||
if (self::hasPermission('modules_selfserve_lane_command_bypass_customer_number_validation')) {
|
||||
$lane->setBypassCustomerNumberValidation(true);
|
||||
|
||||
Reference in New Issue
Block a user