Commit Graph

2961 Commits

Author SHA1 Message Date
9edcaa52e9 Fix phpstan issues 2026-03-04 15:09:53 +01:00
7bf619aeca Refactor transaction logic in AuditDumpRequestHandler and optimize audit dumping process
- Removed unused `StoredObjectRepository` dependency and improved transaction management by replacing `beganTx` flag with `isTransactionActive` checks.
- Adjusted entity locking logic to separate `find()` and `lock()` calls for `StoredObject`.
- Simplified `AuditEventDumper` by removing redundant assertions and unused `AuditTrail` import.
- Standardized subject display configuration in `AuditEventDumper` and ensured consistent data formatting.
2026-03-04 15:09:32 +01:00
5494f227c4 Add audit trail menu, permissions checks, and updated translations
- Added a new menu item for viewing audit trails with associated permissions checks.
- Integrated access control using `ROLE_SEE_AUDIT_TRAILS` in multiple controllers.
- Updated French translations for audit trail-related labels and menu items.
2026-03-03 14:43:29 +01:00
95437bd06d Refactor user repository fields management and enhance query structure
- Moved the `FIELDS` constant from `UserRepository` to `UserRepositoryInterface` to improve consistency and sharing.
- Updated SQL queries to include new fields (`absenceStart`, `mainLanguage`, and `isRoleSeeAuditTrails`).
- Streamlined CSV export logic to reference the shared `FIELDS` constant.
2026-03-03 14:13:16 +01:00
cd29e3150a Add role management for users and update related translations and templates
- Added a `roles` column to the `users` table using a JSONB data type.
- Updated the `User` entity to include role management methods (`getRoles`, `addRole`, `removeRole`).
- Modified the `UserType` form to allow selecting special roles.
- Updated Twig templates to display assigned roles in the user list.
- Added new translations for roles and updated French translation keys in `messages.fr.yml`.
2026-03-03 14:13:04 +01:00
546d5bf1f7 Update French translation for "list" title in events section
- Changed "Liste des événements" to "Liste des accès" in `messages.fr.yml` for consistency with access terminology.
2026-02-27 16:13:27 +01:00
72131dc2f8 Add "list" action to audit functionality and French translations
- Introduced `AUDIT_LIST` constant in `AuditTrail` entity to support "list" action auditing.
- Updated French translations (`messages.fr.yml`) to include label for "list" action.
2026-02-27 15:57:11 +01:00
8c88fca2ee Add TriggerAuditInterface and TriggerAuditService to handle audit event triggering
- Introduced `TriggerAuditInterface` to define the contract for triggering audit events.
- Implemented `TriggerAuditService` to encapsulate audit event creation and persistence logic.
- Added methods to handle audit actions with metadata and translatable descriptions.
2026-02-26 14:13:44 +01:00
1099302ab2 Add French translations and implement UI for audit trail download statuses
- Added new French translations for audit trail download states in `messages.fr.yml`.
- Updated `waitForDump` endpoint to render a Twig template with download status.
- Created `download.html.twig` to display the download status with dynamic messages for different states.
2026-02-23 13:48:40 +01:00
6b9377025f Add French translations and display logic for audit trail item count and export limit
- Added French translations for audit trail count and export limit messages in `messages+intl-icu.fr.yaml`.
- Updated `list.html.twig` to display the total number of audit items and a message if items exceed the exportable limit (`MAX_LINES`).
2026-02-23 11:59:08 +01:00
8f16083278 Add French translation for "Download" in messages.fr.yml 2026-02-23 11:44:54 +01:00
98130bb452 Add "Download" button to Audit Trail list when items are within exportable limit
- Display a download button if the total number of audit trail items is within `MAX_LINES`.
- Added the download action as a form submission with the appropriate route.
2026-02-23 11:44:41 +01:00
3b8984eec5 Add AuditDumpRequestHandler to process audit dump requests and ensure transactional consistency
- Introduced `AuditDumpRequestHandler` to handle `AuditDumpRequestMessage` with transactional safety.
- Added custom exceptions `AuditDumpTooMuchLines` and `AuditDumpAlreadyGeneratedException` for enhanced error reporting during processing.
- Created unit tests in `AuditDumpRequestHandlerTest` to validate normal processing, exception handling, and edge cases.
- Implemented locking mechanism and state management for `StoredObject` while processing requests.
2026-02-23 11:44:32 +01:00
07417387bb Add audit trail dump generation and status retrieval endpoints
- Added `generateDump` method to handle audit trail dump creation and queue a processing request.
- Introduced `waitForDump` endpoint to retrieve the status of a pending dump.
- Updated controller dependencies to include `MessageBusInterface`, `EntityManagerInterface`, `ClockInterface`, and `UrlGeneratorInterface`.
- Marked `AuditTrailSearchController` as `readonly` for improved immutability.
2026-02-23 11:44:17 +01:00
7324d8dfc7 Refactor AuditEventDumper for enhanced error handling and customization.
- Added `AuditDumpAlreadyGeneratedException` and `AuditDumpTooMuchLines` exceptions to improve error reporting during dump operations.
- Introduced `MAX_LINES` constant to limit the number of lines in dumps.
- Modified `dump` method to accept a `StoredObject` as a parameter and handle its state transitions.
- Updated `AuditEventDumperTest` to reflect changes in `dump` method and validate error scenarios.
2026-02-23 11:44:06 +01:00
3fbdedc239 Add findByCriteriaIterator method to AuditTrailRepository for streaming large datasets
- Introduced a memory-efficient iterable result method to handle large datasets.
- Ensures data is streamed without loading all rows into memory, improving performance for extensive audit trail processing.
2026-02-17 18:50:00 +01:00
1c9b475640 Add AuditEventDumperTest to validate audit event dumping functionality
- Introduced a test case for `AuditEventDumper` to ensure proper CSV generation and storage.
- Verified metadata, user, and entity subject data accuracy in the dumped output.
2026-02-17 18:49:31 +01:00
a0796852dd Add support for audit event dumping and improve subject rendering flexibility
- Added `AuditEventDumper` class to generate and store CSV exports of audit events based on search criteria.
- Updated `SubjectDisplayerInterface` and related classes to support multiple output formats (`html` or `string`) for subject rendering.
2026-02-17 18:49:14 +01:00
b89911e307 Add RemoveOldAuditCronJob to clean up outdated audit trails
- Introduced `RemoveOldAuditCronJob` class implementing `CronJobInterface` to delete old audit trails based on configured retention period.
- Added `deleteBefore` method to `AuditTrailRepository` to handle removal of records older than the specified date.
- Created `RemoveOldAuditCronJobTest` to ensure correct functionality for job execution and canRun logic.
- Updated DI configuration to include the `delete_after` parameter for audit trail retention settings.
2026-02-17 12:04:22 +01:00
ceb58de858 Add pagination support to Audit Trail listing
- Added `countByCriteria` method in `AuditTrailRepository` to retrieve the total count of records based on criteria.
- Injected `PaginatorFactoryInterface` into `AuditTrailSearchController` and updated the controller to handle pagination logic.
- Updated the `list.html.twig` template to render the pagination controls using `chill_pagination`.
2026-02-17 11:07:12 +01:00
30d4623db6 Add user-based filtering support to Audit Trail search functionality
- Extended `AuditTrailRepository` to include user-based query filtering.
- Updated `AuditTrailSearchController` to handle `by_users` filter criteria.
- Modified translations and templates to support the new user picker field in the search form.
- Injected required CSS and JS assets for the user picker functionality.
2026-02-17 11:01:59 +01:00
84c5235446 Improve rendering of associated subjects in audit trail template
- Refactored subject rendering loop to handle spacing and comma placement more efficiently.
- Ensured correct output when rendering multiple associated subjects.
2026-02-17 09:33:20 +01:00
8df06504ba Add support for associated subject conversion in AccompanyingPeriodWorkSubjectConverter
- Updated `convert` method to append associated subjects when `$includeAssociated` is true.
- Modified `SubjectConverterManager` to pass `$includeAssociated` to converters during subject resolution.
2026-02-17 09:33:04 +01:00
fa38f7edaa Add advanced filtering support to AuditTrailSearchController and related views
- Introduced filters for date range, course number, and person number using `FilterOrderHelper`.
- Updated `AuditTrailSearchController` to build and process filtering criteria dynamically.
- Enhanced translations and updated templates to render the new filter options.
2026-02-16 15:14:17 +01:00
4e9846930b Refactor AuditTrailRepository to extract query-building logic and add support for date and subject-based filtering
- Moved query-building logic to a new `buildByCriteriaQuery` private method for better modularity.
- Added handling for `from_date`, `to_date`, and subject-based filtering using `JSONB` containment for improved query flexibility.
2026-02-16 15:14:17 +01:00
dd3a08f766 Add support for integer fields in FilterOrderHelper and FilterOrderHelperBuilder
- Introduced methods to define, retrieve, and process integer fields in `FilterOrderHelper` and `FilterOrderHelperBuilder`.
- Updated `FilterOrderType` to render integer fields dynamically as form inputs.
- Added corresponding support in `FilterOrderGetActiveFilterHelper` to handle integer field data.
- Updated `FilterOrderPositionEnum` and template files to include integer field rendering logic.
- Enhanced entity labels with translation capabilities where applicable.
2026-02-16 15:14:16 +01:00
16c5fd0cf2 Add JsonbContains custom DQL function and corresponding test
- Introduced `JsonbContains` class to enable the usage of PostgreSQL's JSONB containment operator in DQL queries.
- Created `JsonbContainsTest` to validate the functionality of the custom DQL function.
2026-02-16 15:14:16 +01:00
cc769fd4ba Support translatable labels in FilterOrderHelper and FilterOrderHelperBuilder
- Updated methods to accept `string|TranslatableInterface` for label parameters, allowing translation capabilities.
- Added `Symfony\Contracts\Translation\TranslatableInterface` imports in both classes.
2026-02-16 13:30:07 +01:00
22ace0c66e WIP: render entities 2026-02-16 13:02:46 +01:00
32c5f21438 Refactor subject conversion handling and enhance audit logging
- Replaced `Subject|array` return types with `SubjectBag` in `SubjectConverterInterface` for more robust handling.
- Updated `getSubjectsForEntity` to include an optional `$includeAssociated` parameter for finer control over associated subject resolution.
- Refactored `AuditEvent` to differentiate `mainSubject` from associated subjects, improving clarity in audit logging.
- Introduced database schema changes to add `main_subject` and `subjects` columns in the `chill_main_audit_trail` table.
- Added `SubjectBag` class for grouped subject management and implemented deduplication logic.
- Updated all converters and test cases to use the new `SubjectBag` approach, ensuring compatibility.
- Improved event dispatching in controllers to utilize the updated `AuditEvent` structure and refined metadata handling.
2026-02-13 17:07:30 +01:00
443ee4cb1a Update insert method in AuditTrailRepository to simplify nullable user handling
- Removed redundant null-check logic for `user_id` assignment.
- Updated query to directly handle optional users with safe navigation and nullable type support.
2026-01-28 22:36:26 +01:00
23d23da6b3 Specify \Throwable explicitly in ConvertSubjectException constructor for improved type clarity. 2026-01-28 22:35:29 +01:00
54e2777fa2 Update AuditTrailRepository to improve user handling and fix nullable user type in AuditTrail
- Changed `getUser` method in `AuditTrail` to allow null values by updating the return type to `?User`.
- Updated `insert` method in `AuditTrailRepository` to handle nullable users, ensuring the `user_id` parameter is set only when applicable.
- Improved code robustness by adding null-check logic for user assignment in the SQL query.
2026-01-28 22:35:13 +01:00
c1a0234358 Refactor subject conversion APIs and simplify usage in audit-related components
- Removed `convertEntityToSubjects` method from `SubjectConverterManager` and updated all references to use `getSubjectsForEntity`.
- Ensured `getSubjectsForEntity` always returns an array by wrapping single `Subject` instances.
- Replaced manual type handling in converters with `array_push` and improved code clarity in `AuditEvent2Trail` and related tests.
- Updated and fixed tests for the modified subject conversion logic to maintain coverage.
2026-01-28 22:34:55 +01:00
624cad8818 Add support for SubjectConverterManager awareness in converters and refactor subject retrieval.
- Introduced `SubjectConverterManagerAwareTrait` and `SubjectConverterManagerAwareInterface` for injecting subject converter manager into converters.
- Added `getSubjectsForEntity` method in `SubjectConverterManager` to centralize subject retrieval logic.
- Updated converters to set the subject converter manager when applicable.
2026-01-28 17:32:07 +01:00
59b322ee8e Register SubjectConverterInterface for autoconfiguration and add new audit services
- Registered `SubjectConverterInterface` for autoconfiguration with the `chill_main.audit_subject_converter` tag.
- Added `audit.yaml` to configure audit-related services and enable service discovery for the `Audit` namespace.
- Updated `services.yaml` to include the new `audit.yaml` configuration.
2026-01-28 16:19:54 +01:00
d6f9aa6b45 Refactor subject conversion in AuditEvent2Trail and enhance SubjectConverterInterface
- Replaced `array_map` with `array_reduce` in `AuditEvent2Trail` for flattening converted subjects.
- Enhanced `SubjectConverterInterface` with a `supportsConvert` method and PHPStan annotations to improve type safety and flexibility.
2026-01-28 16:19:25 +01:00
e27876aeeb Update AuditTrail entity with standardized column naming and new constants
- Renamed entity columns to adhere to naming convention (`action`, `id`, `occurredat`, `user_id`, `description`, `targets`, `metadata`).
- Added constants for audit actions (`AUDIT_VIEW`, `AUDIT_CREATE`, `AUDIT_UPDATE`, `AUDIT_DELETE`).
2026-01-28 16:18:58 +01:00
ee624cae4b Add AuditTrailPersisterInterface and improve AuditTrailPersister
- Introduced `AuditTrailPersisterInterface` to define the persisting contract.
- Updated `AuditTrailPersister` to implement the interface and delegate persistence to `AuditTrailRepository`.
- Added `AuditTrailRepository` with `persistImmediately` method to save audit trails directly to the database.
2026-01-28 16:18:45 +01:00
6bbdc858bd Add audit system core with event handling and subject conversion
- Implemented `AuditEvent` class to represent audit events.
- Added `AuditEvent2Trail` for converting events to audit trails.
- Introduced `Subject` and `SubjectConverterManager` for subject conversion.
- Created contracts like `SubjectConverterInterface` and `AuditEvent2TrailInterface`.
- Developed `AuditEventSubscriber` to persist audit events using `AuditTrailPersister`.
- Included test classes for core audit services and components.
2026-01-23 17:33:48 +01:00
ed41224d7a Add audit trail entity and migration
- Introduced `AuditTrail` entity to track user actions.
- Added Doctrine migration to create the `chill_main_audit_trail` table.
2026-01-23 17:33:18 +01:00
b6152d5356 Fix issues with permission for stored objects associated with workflows 2026-01-15 16:54:37 +00:00
06c5affbe7 Increase delay for removing stale workflows from 90 to 180 days
- Updated `KEEP_INTERVAL` in `CancelStaleWorkflowCronJob` to `P180D`.
2026-01-15 10:08:40 +01:00
bf461a1211 Merge branch '473-display-bundles-version' into 'master'
Resolve "Afficher le numéro de version de Chill dans l'UX"

Closes #473

See merge request Chill-Projet/chill-bundles!947
2026-01-13 15:35:26 +00:00
3f0ad51114 Resolve "Afficher le numéro de version de Chill dans l'UX" 2026-01-13 15:35:26 +00:00
8eb7a55ef5 Prevent notifications from being sent when the user signs a document he asked to himself 2026-01-13 15:31:49 +00:00
4919c03660 Eslint fixes 2025-12-05 15:09:15 +00:00
2ef789a794 fix eslint 2025-12-05 15:01:21 +01:00
9d398f2cb5 Merge branch 'dutch-translations' into 'master'
Dutch translations

See merge request Chill-Projet/chill-bundles!934
2025-12-05 12:00:56 +00:00
7186fd9fb8 Dutch translations 2025-12-05 12:00:56 +00:00