Cfodev 1669 review archival rules who and when can archive#1148
Merged
Carl Sixsmith (carlsixsmith-moj) merged 3 commits intoJun 21, 2026
Conversation
Carl Sixsmith (carlsixsmith-moj)
requested changes
Jun 18, 2026
Carl Sixsmith (carlsixsmith-moj)
left a comment
Contributor
There was a problem hiding this comment.
Not a fan of random static classes enforcing business rule.
We have IBusinessRule that can implement the guard and offer the lowest level of protection at the aggregate level.
The UI button logic can be managed through a simple check of the users tenantid and the tenantid of the owner of the case.
d17a290 to
c7a9143
Compare
…ints are consistently protected -Removed validator and enforced in the authorisation path because pipeline runs validation before authorisation, so putting access checks in validators can return the wrong failure type and may leak participant-existence details -Renamed ParticipantArchiveAccess.CanAccess to ParticipantArchiveAccess.CanArchive, was a bit repetitive -updated tests accordingly
-Implemented this as a domain guard via IBusinessRule, authorisation now sits at aggregate level. -Removed ParticipantArchiveAccess helper and a simple owner/tenant visibility check on UI
deb5494 to
d5024f2
Compare
Carl Sixsmith (carlsixsmith-moj)
approved these changes
Jun 21, 2026
Carl Sixsmith (carlsixsmith-moj)
pushed a commit
that referenced
this pull request
Jun 25, 2026
* Enforce archive authorization by owner or tenant hierarchy * Enforced in the authorization path (or handler guard) so all entry points are consistently protected -Removed validator and enforced in the authorisation path because pipeline runs validation before authorisation, so putting access checks in validators can return the wrong failure type and may leak participant-existence details -Renamed ParticipantArchiveAccess.CanAccess to ParticipantArchiveAccess.CanArchive, was a bit repetitive -updated tests accordingly * Domain guard via IBusinessRule, -Implemented this as a domain guard via IBusinessRule, authorisation now sits at aggregate level. -Removed ParticipantArchiveAccess helper and a simple owner/tenant visibility check on UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new business rule to control who is authorized to archive a participant, ensuring that only the participant's owner or users from the same or higher-level tenant can perform the archive action. It updates both backend and frontend logic to enforce this rule, adds relevant data to DTOs, and includes comprehensive unit tests for the new rule and its effects.
Authorization and Business Rule Enforcement
ParticipantMustBeArchivableByUserto enforce that only the participant's owner or users from the same or higher-level tenant can archive a participant.ArchiveCasecommand handler to use the newArchivemethod, which applies the business rule, and now requiresICurrentUserServicefor user context. [1] [2] [3]Archivemethod in theParticipantentity, which checks the business rule before allowing the status transition.Frontend and DTO Updates
ParticipantSummaryDtoand related mapping to includeOwnerIdandOwnerTenantId, enabling the frontend to determine archive permissions. [1] [2] [3]Testing
ParticipantMustBeArchivableByUsercovering various scenarios (owner, higher/same/lower tenant, different branch).🔗 Related Work
📌 Summary
---Unauthorised users should not be able to archive i.e. if they are not case owner or are not at same level as owner's tenant or higher.
🎯 Purpose / Motivation
🧠 Approach
---As pipeline runs validation before authorization, so chose to move access checks in validators to handler because they are better enforced in the authorization path
🔄 Changes
🧪 How to Test
a. Archive should be hidden
b. (IT Only)To test if server side validations works, make Archive button visible by removing ParticipantArchiveAccess.CanArchive from ParticipantActionMenu.razor page and try to archive, it should show error message that "You are not authorized to archive this participant".
Expected result:
📸 Screenshots / Output (if applicable)
Details:
🙋 Notes for Reviewers