Release v.2.14.1 - #80
Conversation
…translations for the risk sources.
…source, residual decission fields and review fields.
Asset-based ISO 27005:2022 alignment
…specific process for the risks acceptance.
…oid any collisions.
…rt/import and analysis creation from another.
…eport and export/import process, improved the history data preparation
There was a problem hiding this comment.
Pull request overview
This PR introduces new “asset-based ISO 27005:2022 alignment” capabilities by adding structured risk metadata (risk sources, review cadence, residual risk acceptance workflow), supervisor-based delegation, and auditable history tracking across information and operational risks.
Changes:
- Add ANR supervisors/roles model and APIs, plus delegated authorization paths for limited risk-field updates and residual risk approvals.
- Introduce risk sources, reassessment triggers, and interested parties (entities, tables, services, APIs) with import/export support.
- Add ANR history tracking (entity/table/service/controller) and record history events for consequences and recommendation linking/unlinking.
Reviewed changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| view/layout/layout.phtml | Loads new front-end JS modules related to history tables and new domain services. |
| src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php | Extends validation rules for operational risk updates (risk source, supervisors, residual acceptance, review metadata). |
| src/Validator/InputValidator/InstanceRiskOp/PatchDelegatedInstanceRiskOpDataInputValidator.php | Restricts PATCH payloads to delegated/supervisor-editable fields for operational risks. |
| src/Validator/InputValidator/InstanceRisk/UpdateInstanceRiskDataInputValidator.php | Extends validation rules for information risk updates (supervisors, residual acceptance, review metadata, risk source). |
| src/Validator/InputValidator/InstanceRisk/PatchDelegatedInstanceRiskDataInputValidator.php | Restricts PATCH payloads to delegated/supervisor-editable fields for information risks. |
| src/Validator/InputValidator/AnrSupervisor/UpdateAnrSupervisorDataInputValidator.php | Validator variant for updating supervisors (name not required). |
| src/Validator/InputValidator/AnrSupervisor/PostAnrSupervisorDataInputValidator.php | Validator variant for creating supervisors (name required). |
| src/Validator/InputValidator/AnrSupervisor/PatchAnrSupervisorStatusInputValidator.php | Validator for patching supervisor active status. |
| src/Validator/InputValidator/AnrSupervisor/AbstractAnrSupervisorDataInputValidator.php | Shared supervisor validation rules (name/email/roles/linking/isActive). |
| src/Validator/FieldValidator/LinkedUserExistenceValidator.php | Validates linked user existence when assigning a linked user ID. |
| src/Table/UserTable.php | Adds user search helper for linking supervisors to users. |
| src/Table/RiskSourceTable.php | Adds persistence/query helpers and “used in risks” checks for risk sources. |
| src/Table/ReassessmentTriggerTable.php | Adds ANR reassessment trigger queries ordered by position. |
| src/Table/InterestedPartyTable.php | Adds ANR interested party queries ordered by position. |
| src/Table/InstanceRiskTable.php | Adds risk-source join/keyword/order support for information-risk listing/search. |
| src/Table/InstanceRiskOwnerTable.php | Removes legacy risk owner table implementation. |
| src/Table/InstanceRiskOpTable.php | Adds risk-source join/keyword/order support for operational-risk listing/search. |
| src/Table/AnrSupervisorTable.php | Adds supervisor query helpers (filters, linked-user lookups, role checks). |
| src/Table/AnrSupervisorRoleTable.php | Adds table wrapper for supervisor roles. |
| src/Table/AnrHistoryTable.php | Adds history query helpers by target/type and latest entry retrieval. |
| src/Service/RiskSourceService.php | Adds CRUD service layer for risk sources with safety checks on deletion. |
| src/Service/ResidualRiskAcceptanceService.php | Implements residual-risk decision action (approval checks + history entries). |
| src/Service/ReassessmentTriggerService.php | Adds CRUD + duplication + import processing for reassessment triggers (position-aware). |
| src/Service/InterestedPartyService.php | Adds CRUD + duplication + import processing for interested parties (position-aware). |
| src/Service/InstanceRiskOwnerService.php | Removes legacy risk owner service implementation. |
| src/Service/AnrRecommendationRiskService.php | Records ANR history events when recommendations are linked/unlinked to risks. |
| src/Service/AnrInstanceConsequenceService.php | Records ANR history events when consequence values/visibility changes affect risks. |
| src/Service/AnrHistoryService.php | Adds history entry creation/batch insert + export-ready formatting. |
| src/Middleware/AnrValidationMiddleware.php | Adds delegated supervisor authorization paths for limited PATCH/POST routes. |
| src/Import/Traits/ImportDataStructureAdapterTrait.php | Adapts import structure for supervisor-based ownership and adds new risk metadata fields. |
| src/Import/Service/InstanceImportService.php | Integrates import processors/services for supervisors, interested parties, reassessment triggers, and risk sources. |
| src/Import/Processor/RiskSourceImportProcessor.php | Adds import processor to upsert risk sources with caching. |
| src/Import/Processor/OperationalInstanceRiskImportProcessor.php | Imports risk source, supervisor ownership, review metadata, and residual acceptance fields for operational risks. |
| src/Import/Processor/InstanceRiskImportProcessor.php | Imports risk source, supervisor ownership, review metadata, and residual acceptance fields for information risks. |
| src/Export/Service/Traits/OperationalInstanceRiskExportTrait.php | Exports risk source, supervisor ownership, review metadata, and residual acceptance data for operational risks. |
| src/Export/Service/Traits/InformationInstanceRiskExportTrait.php | Exports risk source, supervisor ownership, review metadata, and residual acceptance data for information risks. |
| src/Export/Service/AnrExportService.php | Extends ANR export to include supervisors, risk sources, interested parties, and reassessment triggers. |
| src/Entity/RiskSource.php | Adds front-office RiskSource entity mapped to risk_sources. |
| src/Entity/ReassessmentTrigger.php | Adds front-office ReassessmentTrigger entity mapped to anr_reassessment_triggers. |
| src/Entity/InterestedParty.php | Adds InterestedParty entity mapped to anr_interested_parties with position support. |
| src/Entity/InstanceRiskOp.php | Extends operational risk entity with risk source, supervisor ownership, review metadata, and residual acceptance fields. |
| src/Entity/InstanceRisk.php | Extends information risk entity with risk source, supervisor ownership, review metadata, and residual acceptance fields. |
| src/Entity/AnrSupervisorRole.php | Adds supervisor role entity and role constants. |
| src/Entity/AnrSupervisor.php | Adds supervisor entity with roles and linked risks relationships. |
| src/Entity/AnrHistory.php | Adds history entity + field/change-type constants for audit log. |
| src/Controller/ApiAnrSupervisorsController.php | Adds REST API controller for supervisor management and user-linking search. |
| src/Controller/ApiAnrRiskSourcesController.php | Adds REST API controller for risk source CRUD/listing. |
| src/Controller/ApiAnrRisksManagementController.php | Adds REST API endpoint for risks management view/batch updates. |
| src/Controller/ApiAnrRiskResidualAcceptanceController.php | Adds REST endpoint for residual acceptance decisions on information risks. |
| src/Controller/ApiAnrRiskOwnersController.php | Removes legacy risk owners API controller. |
| src/Controller/ApiAnrReassessmentTriggersController.php | Adds REST API controller for reassessment triggers CRUD/listing. |
| src/Controller/ApiAnrOperationalRiskResidualAcceptanceController.php | Adds REST endpoint for residual acceptance decisions on operational risks. |
| src/Controller/ApiAnrInterestedPartiesController.php | Adds REST API controller for interested parties CRUD/listing. |
| src/Controller/ApiAnrInstancesRisksOpController.php | Extends responses and adds delegated PATCH flow for operational risks. |
| src/Controller/ApiAnrInstancesRisksController.php | Extends responses and adds delegated PATCH flow for information risks. |
| src/Controller/ApiAnrHistoryController.php | Adds REST API endpoint to fetch ANR history entries. |
| migrations/db/20260615120000_create_anr_history_table.php | Creates anr_history audit table. |
| migrations/db/20260603120000_add_anr_supervisors.php | Adds supervisors/roles tables + migrates legacy owners into supervisors + adds new risk columns/FKs. |
| migrations/db/20260522101000_add_interested_parties.php | Creates anr_interested_parties table. |
| migrations/db/20260519101000_add_residual_risk_acceptance.php | Adds residual risk acceptance fields (initial schema) and operational risk source FK. |
| migrations/db/20260515101000_add_risk_review_metadata.php | Adds review metadata fields and reassessment trigger monitoring approach. |
| migrations/db/20260511101000_add_anr_reassessment_triggers.php | Creates anr_reassessment_triggers table. |
| migrations/db/20260505100000_add_risk_sources.php | Creates risk_sources table, seeds defaults per ANR, and adds FK to information risks. |
| composer.json | Upgrades Guzzle to v7 and adds explicit guzzlehttp/psr7 dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* origin/feature/AB-17: Add assigned risk counts for linked supervisors
… of each one, to simplify the access.
* origin/stage: Add assigned risk counts for linked supervisors Moved the duplicated export methods to a trait. FIxed the users creation command to set the proper password. # Conflicts: # src/Service/AnrService.php
…ed the anr permissions withdrawal issue.
…ated to the reassessment trigger criteria.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 78 out of 78 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:31
riskSourceIdusesToInt, which will coerce empty strings to0. Downstream (AnrInstanceRiskOpService::getRiskSourceFromData) treats onlynull/''as "clear" and will try to load ID 0 otherwise. Normalize empty input tonulllike the InstanceRisk validator does.
src/Validator/InputValidator/AnrSupervisor/PatchAnrSupervisorStatusInputValidator.php:21isActiveis marked as required but alsoallow_empty => true. With the Boolean filter + controller cast to bool, an empty/null payload can be accepted and interpreted asfalse, unintentionally deactivating a supervisor. Require a non-empty value for this field.
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:264reviewFrequencyhas no length validation, but the DB column is limited (e.g.InstanceRiskOp::$reviewFrequencyislength=50). This can lead to persistence errors when longer values are submitted. Add aStringLengthvalidator (and normalize empty strings to null for consistency with the InstanceRisk validator).
Added the PDF reports generation possibility
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 78 out of 79 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:31
riskSourceIdis filtered withToInt, which turns an empty string into0. Downstream code treats onlynull/"" as "unset" and will attemptfindById(0), causing an unnecessary lookup/error for PATCH/PUT payloads that send an empty value. Use a callback that preserves null for empty input (consistent with other *SupervisorId and InstanceRisk validators).
src/Service/ResidualRiskAcceptanceService.php:112normalizeDecision()currently treats decisions case-sensitively and rejects the legacy valuerejected, even though other parts of the codebase accept/translate it as an alias ofnot_accepted. This can break clients sendingrejected(or different casing). Normalize to lowercase and maprejected->not_accepted.
…ext reassessment date, fixed assigned to RO and RRA risks number.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 79 out of 80 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:33
riskSourceIdis optional, but usingToIntwill convert an empty string to0. That can lead to attempting to assign risk source ID 0 instead of clearing the field (null). Align this filter with the other optional *Id fields by returningnullfornull/'' and casting otherwise.
src/Service/ResidualRiskAcceptanceService.php:116normalizeDecision()currently rejects the legacy value"rejected"even though other parts of the codebase (validators and exports) treatrejectedas an alias ofnot_accepted. Also, it doesn't normalize case, so e.g."Accepted"will be rejected. Consider lowercasing and mappingrejected->not_acceptedto keep API behavior consistent.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 81 out of 82 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:34
riskSourceIdis filtered withToInt, which castsnull/''to0. The service layer treats onlynull/''as “clear risk source” and otherwise callsfindById((int)$riskSourceId), so an empty value will become0and likely trigger a lookup for ID 0 instead of clearing.
src/Service/ResidualRiskAcceptanceService.php:116normalizeDecision()only accepts exact "accepted" / "not_accepted" and does not lowercase input. Elsewhere in this PR, validators accept the legacy value "rejected" (and lowercasing is applied), and import code normalizes "rejected" -> "not_accepted". As-is, the residual acceptance endpoint can reject values that the rest of the API considers valid.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 81 out of 82 changed files in this pull request and generated 1 comment.
Suppressed comments (4)
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:30
- riskSourceId is filtered with ToInt, so an empty string (""), which the service treats as "no risk source", becomes 0. Downstream, AnrInstanceRiskOpService::getRiskSourceFromData() will then call findById(0), which is likely an invalid ID and can throw. Align this with the InstanceRisk validator by converting null/"" to null before casting to int.
src/Validator/InputValidator/InstanceRiskOp/UpdateInstanceRiskOpDataInputValidator.php:87 - residualRiskDecision currently allows the legacy value "rejected" and passes it through unchanged. Other parts of the code normalize legacy "rejected" to "not_accepted" (e.g., import processors) and ResidualRiskAcceptanceService only accepts "accepted"/"not_accepted". To avoid persisting mixed values, normalize "rejected" to "not_accepted" in this filter.
src/Validator/InputValidator/InstanceRisk/UpdateInstanceRiskDataInputValidator.php:179 - residualRiskDecision currently allows the legacy value "rejected" and passes it through unchanged. Other parts of the code normalize legacy "rejected" to "not_accepted" and ResidualRiskAcceptanceService only accepts "accepted"/"not_accepted". To avoid persisting mixed values, normalize "rejected" to "not_accepted" in this filter.
src/Validator/InputValidator/AnrSupervisor/PatchAnrSupervisorStatusInputValidator.php:26 - PatchAnrSupervisorStatusInputValidator marks isActive as required but also allow_empty=true. With Laminas\Filter\Boolean, empty payloads like null/"" will be coerced to false and still considered valid, which can unintentionally deactivate a supervisor. Require an explicit boolean by disallowing empty values here.
…een translatable and singular value fields.
[Create a real blank analysis](monarc-project/MonarcAppFO#324)
…rvisors link selector.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
New features:
Fixes: