Add PUT route for editing order bookings with permissions
- Introduced a new `/order-bookings` PUT route to enable editing of existing bookings. - Added permission `edit_bookings` for access control. - Adjusted parameter type handling with explicit casting for validation.
This commit is contained in:
@@ -120,6 +120,15 @@ class orderBookingRoute
|
||||
'list_bookings' => 'Permission to list department order bookings.',
|
||||
]
|
||||
);
|
||||
|
||||
$this->put('/order-bookings', function () {
|
||||
// Require the user to be logged in
|
||||
global $response;
|
||||
},
|
||||
[
|
||||
'edit_bookings' => 'Permission to edit order bookings. Only applies to bookings already permitted.'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +141,7 @@ class orderBookingRoute
|
||||
$error = 'Invalid ' . $parameter;
|
||||
if (!$this->isParametersSet([$parameter])) return null;
|
||||
self::requireParameters(['id']);
|
||||
self::requireType(self::getParameter($parameter), self::type_int());
|
||||
self::requireType((int)self::getParameter($parameter), self::type_int());
|
||||
self::requireMinLength($parameter, 1);
|
||||
self::requireMaxLength($parameter, 9);
|
||||
$value = (int)self::getParameter($parameter);
|
||||
|
||||
Reference in New Issue
Block a user