Add order bookings functionality with permissions and access control

- Introduced `order_bookings_o` class for interacting with the `order_bookings` database table.
- Added `hasDepartmentAccess` method to handle department-level permissions.
- Implemented new routes for creating and retrieving order bookings, including pagination support.
- Enhanced access control to differentiate between own and departmental bookings based on permissions.
- Updated input validation and improved error handling for order bookings.
This commit is contained in:
Jeppe Bundgaard
2025-11-05 13:57:12 +01:00
parent f206e7f4fb
commit b564d8d500
3 changed files with 202 additions and 45 deletions
+12
View File
@@ -217,6 +217,18 @@ trait route_t
self::requirePermission('department_access_' . $department . ($permission ? '_' . $permission : ''));
}
/**
* Has department access?
* @note This checks if the user has access to the department by checking if the user has the permission department_access_{department} (_{permission} if provided)
* @param string $department
* @param string|null $permission
* @return bool
*/
public function hasDepartmentAccess(string $department, string|null $permission = null): bool
{
return self::hasPermission('department_access_' . $department . ($permission ? '_' . $permission : ''));
}
/**
* Require permission
* @param string $permission