Commit Graph
776 Commits
Author SHA1 Message Date
Jeppe Bundgaard e6358d09fc Ensure isWashCertificate check is case-insensitive in attachment.php 2026-02-16 15:32:37 +01:00
Jeppe Bundgaard 1791a62992 Remove port from file download URLs in attachment_store.php and upload_store.php 2026-02-16 15:10:38 +01:00
Jeppe Bundgaard 0c411fa3b8 Add deprecated /tmp-send-email route with welcome email functionality
- Introduce a temporary route to send deprecated responses for email testing.
- Use `sendWelcomeEmailToCustomer` from the `email` class to implement email-sending logic.
2026-02-16 14:57:47 +01:00
Jeppe Bundgaard 4248de1d7d Add password reset link generation and welcome email functionality
- Introduce `generatePasswordResetLink` method in `users_o` for creating secure password reset links.
- Add `sendWelcomeEmailToCustomer` method to `email` class with support for attachments.
- Update `authRoute.php` to send welcome emails when creating new customers.
- Extend `sendEmail` to handle optional attachments and references.
- Disable PHP entrypoint in Dockerfile for improved flexibility.
2026-02-16 14:55:01 +01:00
Jeppe B 82e41f45a9 Merge pull request #127 from copenhagentruckwash/scalability-enhancement
scalability-enhancement
2026-02-16 13:26:55 +01:00
Jeppe Bundgaard 29a07e652c Enhance CORS handling in Traefik and Caddy
- Add preflight routers and attach `secure-headers` middleware in Traefik for `api.truckwash.dk` and `cloud.truckwash.dk`.
- Update `secure-headers` middleware with refined CORS headers and stricter origin/method/header configurations.
- Remove redundant CORS logic in Caddy, delegating CORS management entirely to Traefik.
2026-02-16 13:25:54 +01:00
Jeppe Bundgaard dd33fa2b19 Update CORS handling in Traefik and Caddy configurations
- Add origin-specific CORS settings to Traefik for `truckwash.io` with credentials support.
- Simplify and standardize CORS headers in Caddy, removing upstream duplication and adjusting preflight logic.
2026-02-16 13:08:38 +01:00
Jeppe Bundgaard 22790705b4 Disable auto HTTPS and improve CORS handling in Caddyfile for internal HTTP and simplified preflight responses. 2026-02-16 12:35:03 +01:00
Jeppe Bundgaard 0ec8339d3e Simplify CORS handling in Caddyfile by allowing all origins and updating preflight response logic. 2026-02-16 12:31:06 +01:00
Jeppe Bundgaard 739beced0d Expand CORS support in Caddyfile to include truckwash.io subdomains alongside truckwash.dk and localhost. 2026-02-16 12:21:46 +01:00
Jeppe Bundgaard ac542a705e Update Caddyfile with refined CORS handling and stricter origin matching for truckwash.dk subdomains and localhost 2026-02-16 12:21:02 +01:00
Jeppe Bundgaard fe0e02b8fe Add Redis healthchecks and startup wait in PHP entrypoint
- Introduce Redis healthchecks in `docker-compose.prod.yml` for better container monitoring.
- Extend PHP Dockerfile with `redis-tools` and enable Composer dependency auto-install.
- Update `docker-entrypoint.sh` to wait for Redis readiness before starting PHP-FPM.
- Remove local Nginx override and simplify development setup.
2026-02-16 12:18:42 +01:00
Jeppe Bundgaard a709656ba3 Add production-ready Traefik configuration with secure headers, TLS settings, and rate limiting 2026-02-16 11:39:28 +01:00
Jeppe Bundgaard 21f64bbb5f Add Prometheus metrics and Jaeger tracing to Traefik configuration 2026-02-16 11:32:24 +01:00
Jeppe Bundgaard 7c2b6f1357 Update Traefik dynamic config with bcrypt-hashed credentials for truckwash. 2026-02-16 11:26:40 +01:00
Jeppe Bundgaard c7ea1e1aaa Add Traefik and Caddy configurations for reverse proxy setup and internal HTTP handling. 2026-02-16 11:15:20 +01:00
Jeppe Bundgaard 8c8de541be - Update Nginx logging with structured JSON and standard combined format for Elastic integration.
- Add new upstream PHP-FPM servers to Nginx configuration for enhanced load balancing.
- Introduce Elastic APM PHP agent in `php.ini` and update Dockerfile for better dependency management.
- Secure Kibana and Elasticsearch connections in Metricbeat/Filebeat configurations with credentials.
- Remove unused PHP dependencies from `composer.json` and `composer.lock`.
2026-02-16 10:58:50 +01:00
Jeppe Bundgaard 8d8137852f Adjust Monday message time check and add deprecated route with CSV export functionality
- Update the Monday message check to start at 07:00 instead of 06:00.
- Add `/tmp-washes-in-time` route to generate and download a CSV file of washes within a specific time range.
- Mark `/tmp-washes-in-time` route as deprecated.
2026-02-16 09:25:11 +01:00
Jeppe Bundgaard 50003c62c4 Add Metricbeat integration for system, Docker, and Nginx metrics
- Enable Nginx `stub_status` endpoint on port 8080 for internal metric collection.
- Add Metricbeat configuration for system, Docker, and Nginx metrics, integrating with Elasticsearch and Kibana.
2026-02-13 22:39:27 +01:00
Jeppe Bundgaard 081d8ad284 Add Dockerfile and entrypoint optimizations, Composer auto-install, and dependency updates
- Use `__DIR__` for `vendor/autoload.php` in PHP autoload path.
- Add Composer dependency auto-installation at container startup with `docker-entrypoint.sh`.
- Extend Docker image to include `libssl-dev` and `ca-certificates` for TLS support.
- Enable dynamic installation of application dependencies during runtime via entrypoint.
- Update Composer dependencies, including AWS SDK, Guzzle, and OpenTelemetry libraries.
2026-02-13 22:21:46 +01:00
Jeppe Bundgaard e66aaecac5 Add Nginx development configuration and Docker Compose override for local setup
- Define HTTP-only Nginx configuration with structured JSON logging and PHP-FPM upstream.
- Add gzip compression, CORS headers, and request ID handling for local development.
- Expose Nginx on port 80 with Docker Compose override file.
2026-02-13 21:22:31 +01:00
Jeppe Bundgaard d7a8fc1d1c Add Nginx TLS configuration, structured logging, PHP-FPM upstream, and Filebeat integration
- Configure Nginx to use structured JSON access logs and add request ID headers.
- Define upstream pool for PHP-FPM with load-balancing support.
- Integrate Filebeat for log ingestion across Nginx and PHP logs.
- Add `.env.example` and README for local TLS setup guidance.
- Extend Dockerfile with PHP extensions (GD, Redis, etc.) and Composer dependency installs.
- Add custom PHP configuration for Redis-backed session storage.
2026-02-13 21:10:50 +01:00
Jeppe Bundgaard aae244887f Extend CORS headers to include X-Customer-Number and add customer context in subuser grants. 2026-02-12 18:12:29 +01:00
Jeppe Bundgaard 05a4943162 Add /subusers/me route for public registration and extend OpenAPI schema
- Add `/subusers/me` as a public registration endpoint, including CVR validation, phone lookup, and optional SMS setup link generation.
- Extend OpenAPI specification with `SubuserSelf` and `SubuserGrantSummary` schemas for returning authenticated subuser profiles and grants.
2026-02-12 16:58:41 +01:00
Jeppe Bundgaard 17701cae69 Refactor subusersRoute to implement dynamic permission handling and effective customer context
- Add `allowOwnOrDepartmentAccess` for scoped permission checks across subuser routes.
- Introduce effective customer resolution using `resolveEffectiveCustomerNumber`.
- Enforce subuser-specific permissions with dynamic grants (`list_own_subuser_grants`, `add_own_subusers`, etc.).
- Update error handling to validate customer context and ensure node-based permission checks.
- Add localized descriptions for new and existing permission nodes.
2026-02-12 16:52:40 +01:00
Jeppe Bundgaard 78a0e9869e Refactor ordersRoute to include targetCustomerNumber in permission checks
- Use `resolveEffectiveCustomerNumber` for determining customer context.
- Adjust own/department access logic and remove unnecessary casting for `customer_id`.
2026-02-12 16:39:49 +01:00
Jeppe Bundgaard 6302fd25df Extend subuser permission system and refactor route permission handling
- Update `subusersRoute` to support subuser authentication and permission checks dynamically.
- Add new permission nodes (`SELFSERVE_LIST`, `SELFSERVE_EDIT`, `SELFSERVE_DELETE`) in `subusers_permission_node_key`.
- Fix typos in vehicle permission constants and ensure proper resolution.
- Enhance `vehiclesRoute` with effective customer context and scoped permission checks.
- Localize new permission nodes with descriptions in Danish.
2026-02-12 16:26:29 +01:00
Jeppe Bundgaard 19139b08cb Extend authentication to handle subuser tokens with customer number resolution 2026-02-12 16:17:32 +01:00
Jeppe Bundgaard 4f9f2a2d71 Enhance API documentation and extend customer context handling for subuser permissions
- Add `X-Customer-Number` header for subuser-specific customer targeting across endpoints.
- Update vehicle-related endpoints (`listVehicles`, `addVehicle`, `editVehicle`, etc.) to include subuser permission checks and customer context handling.
- Refactor request and response schemas for vehicle operations to reflect new requirements and improve clarity.
- Include detailed permission scoping and descriptions for subuser and broader access handling.
- Extend OpenAPI specification with enriched schema properties and additional responses for edge cases.
2026-02-12 16:01:30 +01:00
Jeppe Bundgaard 16094575a7 Refactor ordersRoute, vehiclesRoute, and related routes for subuser permission handling
- Integrate `subusers_permission_node_key` for dynamic subuser-specific permission checks.
- Refactor authentication and permission logic to streamline checks for own vs. department-level access.
- Simplify error handling and enforce scoped permissions for vehicles, orders, and their attachments.
- Localize permission labels and descriptions to Danish for relevant modules.
2026-02-12 15:52:37 +01:00
Jeppe Bundgaard f265a83034 Refactor route_t and orderBookingRoute to simplify permission handling
- Add reusable helpers: `isOwnCustomerContext`, `resolveEffectiveCustomerNumber`, and `allowOwnOrDepartmentAccess` in `route_t` for streamlined permission checks.
- Replace inlined permission logic in `orderBookingRoute` with common helpers for creating, viewing, editing, and deleting bookings.
- Localize permission names, descriptions, and labels to Danish across relevant modules.
- Improve error handling and simplify context resolution for subuser and department-level permissions.
2026-02-12 15:43:02 +01:00
Jeppe Bundgaard cd894b4e3b Refactor orderBookingRoute to integrate subuser-specific permission checks
- Add dynamic authentication and subuser permission handling using `subusers_permission_node_key`.
- Refactor route-level permission logic for creating, viewing, editing, and deleting bookings to respect subuser context.
- Ensure proper error handling for unauthorized access and enforce departmental scope for admin-level actions.
2026-02-12 15:37:03 +01:00
Jeppe Bundgaard 497ef1496b Add subuser permission evaluation system and extend subuser-related route handling
- Introduce `hasPermission` method in `subusers_o` for permission checks tied to customer context.
- Update `/subusers/me` route to return subuser grants with normalized permissions and metadata.
- Add `get_subuser_customer_number_target` in `authentication` to resolve customer context from request headers.
- Refactor route-level permission checks to handle subuser grants dynamically.
- Introduce CLI test scripts for subuser grants and permission node mappings.
- Add test coverage for subuser grants and permission nodes in new test classes.
2026-02-12 15:29:43 +01:00
Jeppe Bundgaard 6375bc7f12 Add explicit fail condition for subuser node key in route permissions
- Ensure permissions pass only if an explicit subuser node key is granted.
- Prevent fallback to classic user permissions in this authentication branch.
2026-02-12 14:28:36 +01:00
Jeppe Bundgaard f2244f5d0d Initialize permission node containers and handle uninitialized properties in subuser_user_grant to ensure proper grant resolution logic. 2026-02-12 14:08:01 +01:00
Jeppe Bundgaard 953067cba5 Extend subuser session handling and refactor permissions in order booking routes
- Add token creation for subusers in `subusers_o` during session generation.
- Refactor `orderBookingRoute` to use dynamic subuser permission definitions with `subusers_permission_node_key`.
2026-02-12 14:01:05 +01:00
Jeppe Bundgaard d26b94de3b Integrate subuser permission node system and refactor route-level permissions
- Add `permission_node` DTO to link classic permissions with subuser-specific nodes.
- Extend `authentication` to support subuser resolution via tokens.
- Introduce route traits for permission evaluation with subuser context.
- Update `requirePermission` and `hasPermission` to handle subuser grants dynamically.
- Implement fallback mechanisms for customer number context in subuser permissions.
2026-02-12 13:54:28 +01:00
Jeppe Bundgaard 2159cd293c Extend type property in tokens_o to support AUTH_TOKEN_SUBUSER 2026-02-12 13:40:19 +01:00
Jeppe Bundgaard 0fddaa79a7 Add name field to /subusers/grants response for improved subuser data clarity
- Retrieve and include the `name` field from the `subusers_o` object in the grant response.
2026-02-12 13:35:47 +01:00
Jeppe Bundgaard 62a7f8d259 Handle bool and json types in object_property and normalize permissions in subuser_grants_o
- Add support for `bool` and `json` types when updating database values in `object_property`.
- Normalize `permissions` handling in `subuser_grants_o` to ensure consistent API output for array data.
2026-02-12 13:19:57 +01:00
Jeppe Bundgaard dcf4252218 Refactor /subusers/grants update logic and require explicit autoloading for subuser module
- Replace route method for updating grants (`PATCH` to `PUT`) and streamline grant updates by directly modifying object properties instead of using manual data arrays.
- Introduce parameter validation for consistency and permission checks for cross-customer grant management.
- Require autoloading for all subuser module components (interfaces, traits, helpers, classes, and permissions) to improve modularity and maintainability.
2026-02-12 13:17:10 +01:00
Jeppe Bundgaard e9e0b3e19e Add include_non_enabled parameter to /subusers endpoint
- Allow listing subusers with only non-enabled grants by introducing an optional `include_non_enabled` query parameter.
- Update SQL query logic to conditionally include non-enabled subuser grants.
- Extend OpenAPI documentation to reflect the new parameter with its description and schema.
2026-02-11 17:58:55 +01:00
Jeppe Bundgaard 34ea4937e0 Add /subusers and /subusers/{id} endpoints for subuser management with permission-based visibility
- Implement routes to list and retrieve subusers based on grant visibility tied to the authenticated user's customer number.
- Extend OpenAPI documentation with detailed descriptions, parameters, and response schemas for the new endpoints.
2026-02-11 17:56:59 +01:00
Jeppe Bundgaard 6b90fe8d8e Refactor /subusers/grants to use paginated response and update dependencies
- Replace manual grant data processing with `listObjectsWithPaginationIfSet` for cleaner pagination and mapping logic.
- Include `subusers_permission_node_key` helper in dependencies.
2026-02-11 17:50:43 +01:00
Jeppe Bundgaard 59040b9cee Add session-based customer number fallback for subuser filtering
- Update `/subusers` route to check the current session user's `customer_number` when no filter is provided.
2026-02-11 17:44:49 +01:00
Jeppe Bundgaard 89b8587dfc Update OpenAPI documentation with new API structure and subuser registration flow
- Add detailed API info, authentication methods, and permission requirements.
- Introduce comprehensive tags for endpoints covering key modules such as Users, Orders, Bookings, Payments, and more.
- Define `/subusers` endpoint for creating subuser registrations with CVR validation and SMS setup flow.
- Update schemas for user and subuser properties, including notifications and timestamps.
2026-02-11 17:39:36 +01:00
Jeppe Bundgaard 354ad86de3 Add CRUD operations for subuser grants and list permission nodes
- Implement routes for managing subuser grants: listing, creating, updating, and deleting.
- Add endpoint to fetch available permission nodes grouped by type.
- Extend `subuser_grants_o` with new utility methods, including `asArray`.
- Update OpenAPI documentation to include new endpoints and schemas.
2026-02-11 17:25:53 +01:00
Jeppe Bundgaard a4f71261d9 Update subuser_grants_o to use default permissions and remove hardcoded driver permission
- Define `defaultPermissions` constant in `subuser_grants_o` for managing default subuser permissions.
- Adjust `add` method to use `defaultPermissions` instead of a hardcoded array.
- Update `/subusers` route to reflect this change.
2026-02-11 17:16:17 +01:00
Jeppe Bundgaard c83b7d49e4 Add permission node system and extend subuser grants functionality
- Introduce a comprehensive permission system for subusers, including permission nodes and types with support for vehicles, bookings, orders, subusers, and self-serve modules.
- Implement `subusers_user`, `subuser_user_grant`, and `subusers_permission_node` classes for managing subuser permissions and grants.
- Extend `subuser_grants_o` with methods to retrieve permissions for subusers linked to customers.
- Add traits and enumerations to streamline permission handling across modules.
- Update subuser session handling to include token-based subuser lookups.
2026-02-11 17:13:25 +01:00
Jeppe Bundgaard 6ad28a26eb Add passkeysRoute for managing user passkeys and extend OpenAPI documentation
- Introduce `passkeysRoute` with operations to list, create, rename, and delete passkeys for authenticated users.
- Update OpenAPI with endpoints and request/response schemas for passkey management.
2026-02-11 15:59:10 +01:00