WIP - Migrate organization and user flows to BaseOrg/BaseUser - #1982
Open
jdalphond-mitre wants to merge 20 commits into
Open
WIP - Migrate organization and user flows to BaseOrg/BaseUser#1982jdalphond-mitre wants to merge 20 commits into
jdalphond-mitre wants to merge 20 commits into
Conversation
… out legacy and registry tests to more easily tell which files are which.
…rization to BaseOrg
…bsolete OrgRepository factory getter and legacy test mocks.
Update legacy user-capacity setup to use BaseOrg membership rather than legacy User records. Add coverage that verifies legacy user create, update, read, and reset-secret responses remain compatible while BaseUser and BaseOrg remain the sources of truth.
Project legacy user reads and write responses directly from BaseUser and BaseOrg membership/admin data, eliminating UserRepository and RegistryUser usage from BaseUserRepository create, update, full update, reset-secret, delete, lookup, and authorization paths. Normalize legacy dotted user fields during creation and re-read the owning BaseOrg before projecting legacy responses so names and ADMIN roles match the persisted BaseUser/BaseOrg state. Avoid logging one-time user secrets in org creation audit records. Release BaseOrg reservation locks before sending post-lock CVE-ID responses, while retaining finally cleanup for exceptions, so an immediately-following reservation is not incorrectly rejected as in progress. Update unit and integration tests for BaseUser-only behavior, legacy write compatibility, and clearer reservation response assertions.
Registry full user updates preserve ADMIN membership when the user remains in the same organization. When org_short_name changes, the user is removed from the source admins list and receives destination membership only. Extend integration coverage for both same-org updates and organization moves.
Use BaseUserRepository when CVE and CVE-ID controllers resolve the authenticated requester UUID for audit metadata, removing their remaining UserRepository factory dependency. Update affected CVE/CVE-ID unit-test factories to provide BaseUserRepository and update registry user-move coverage to require destination membership without destination ADMIN access.
Make BaseOrg the sole source of ADMIN membership by removing the legacy User collection updates from addAdmin() and removeAdmin(). Legacy user responses continue to derive active_roles from BaseOrg membership through the compatibility projection. Expand admin-role integration coverage to verify that: - legacy grants remain visible through registry reads, - registry revokes remain visible through both API formats, and - registry grants remain visible through legacy reads.
Remove the legacy UserRepository factory import and getter now that all production callers use BaseUserRepository. Delete the retired UserRepository implementation and its unit coverage. Update remaining middleware, user-update, and reservation test helpers to use BaseOrgRepository and BaseUserRepository exclusively.
Seed canonical BaseOrg/BaseUser fixtures directly, including memberships, admin references, discriminator types, and quotas. Remove the legacy Org/User migration script and obsolete test setup references. Update population helpers and affected tests to use Base repositories only. Retain Monday migration support for existing BaseOrg/BaseUser data.
david-rocca
requested changes
Aug 28, 2026
david-rocca
left a comment
Collaborator
There was a problem hiding this comment.
The factory no longer exposes the legacy repositories, but these artifacts remain:
Collaborator
|
In addition, we need to fix the lint issues. |
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.
Summary
#1942
#1943
Migrates CVE, CVE-ID, organization, and user flows away from legacy repository dual-writes while preserving legacy-format compatibility where required.
Important Changes
src/repositories/baseOrgRepository.js/src/repositories/baseUserRepository.jssrc/utils/orgCompatibility.js/src/utils/userCompatibility.jssrc/controller/src/repositories/userRepository.js/src/scripts/migrate.jstest/Testing
bash -i -c "npm run test:integration".