Skip to content

Add Secretariat endpoints for ROOT organization reports-to management - #1950

Merged
jdaigneau5 merged 2 commits into
2.8.4-releasefrom
jd_1933
Jul 29, 2026
Merged

Add Secretariat endpoints for ROOT organization reports-to management#1950
jdaigneau5 merged 2 commits into
2.8.4-releasefrom
jd_1933

Conversation

@jdalphond-mitre

Copy link
Copy Markdown
Collaborator

Resolves issue #1933, add dedicated Secretariat endpoints for managing ROOT organization reports-to relationships.

Closes Issue #1933

Summary

Adds a supported, auditable way for Secretariat users to assign and remove an organization’s ROOT reports-to relationship.

Important Changes

src/controller/registry.controller/index.js

  • Adds Secretariat-only POST endpoints to add and remove oversees relationships.
  • Documents both endpoints in OpenAPI.

src/controller/registry.controller/org.registry.controller.js

  • Validates that the overseeing organization has ROOT authority.
  • Handles relationship creation and removal in a transaction.
  • Prevents standard organization PUT requests from updating oversees.

src/repositories/baseOrgRepository.js

  • Adds repository methods to assign and remove relationships.
  • Removes a reporting organization from any previous ROOT parent during reassignment.
  • Creates audit entries for affected ROOT organizations.

src/controller/registry.controller/org.error.js

  • Adds an error response for attempts to assign a non-ROOT overseeing organization.

test/integration-tests/registry-org/rootOrgTest.js

  • Covers assignment, reassignment, removal, invalid ROOT authority, missing organizations, and authorization.

test/integration-tests/registry-org/registryOrgCRUDTest.js

  • Verifies standard PUT requests cannot create oversees or derived reports_to relationships.

Testing

  • 1) Run the registry organization integration test suite.
  • 2) As a Secretariat user, assign a reporting organization to a ROOT organization and confirm reports_to is returned.
  • 3) Reassign that organization to a different ROOT organization and confirm the prior relationship is removed.
  • 4) Remove the relationship and confirm reports_to is no longer returned.
  • 5) Verify ROOT admins cannot manage relationships or modify oversees through the standard PUT endpoint.

Notes

Relationship management is intentionally restricted to the dedicated Secretariat endpoints; standard organization updates ignore the oversees field.

Add Secretariat-only endpoints for assigning and removing an
organization’s reports-to relationship with a ROOT organization.

- Add documented POST endpoints to add and remove ROOT `oversees`
  relationships.
- Validate that the overseeing organization has ROOT authority and return
  clear errors when either organization is not found.
- Reassign a reporting organization atomically by removing it from a
  previous ROOT organization before adding the new relationship.
- Audit additions, removals, and reassignments for every affected ROOT
  organization.
- Ignore `oversees` in standard organization PUT requests so reports-to
  relationships can only be managed through the dedicated endpoints.
- Update existing CRUD coverage to verify PUT requests cannot create
  `oversees` or derived `reports_to` relationships.
- Add ROOT organization integration coverage for successful assignment,
  reassignment, removal, invalid non-ROOT parents, missing organizations,
  and Secretariat-only authorization.
Comment thread src/controller/registry.controller/index.js Dismissed
Comment thread src/controller/registry.controller/index.js Dismissed
@jdaigneau5
jdaigneau5 merged commit cc9bbc6 into 2.8.4-release Jul 29, 2026
9 checks passed
@87quebad-lang

Copy link
Copy Markdown

Resolves issue #1933, add dedicated Secretariat endpoints for managing ROOT organization reports-to relationships.

Closes Issue #1933

Summary

Adds a supported, auditable way for Secretariat users to assign and remove an organization’s ROOT reports-to relationship.

Important Changes

src/controller/registry.controller/index.js

  • Adds Secretariat-only POST endpoints to add and remove oversees relationships.

  • Documents both endpoints in OpenAPI.

src/controller/registry.controller/org.registry.controller.js

  • Validates that the overseeing organization has ROOT authority.

  • Handles relationship creation and removal in a transaction.

  • Prevents standard organization PUT requests from updating oversees.

src/repositories/baseOrgRepository.js

  • Adds repository methods to assign and remove relationships.

  • Removes a reporting organization from any previous ROOT parent during reassignment.

  • Creates audit entries for affected ROOT organizations.

src/controller/registry.controller/org.error.js

  • Adds an error response for attempts to assign a non-ROOT overseeing organization.

test/integration-tests/registry-org/rootOrgTest.js

  • Covers assignment, reassignment, removal, invalid ROOT authority, missing organizations, and authorization.

test/integration-tests/registry-org/registryOrgCRUDTest.js

  • Verifies standard PUT requests cannot create oversees or derived reports_to relationships.

Testing

  • 1) Run the registry organization integration test suite.

  • 2) As a Secretariat user, assign a reporting organization to a ROOT organization and confirm reports_to is returned.

  • 3) Reassign that organization to a different ROOT organization and confirm the prior relationship is removed.

  • 4) Remove the relationship and confirm reports_to is no longer returned.

  • 5) Verify ROOT admins cannot manage relationships or modify oversees through the standard PUT endpoint.

Notes

Relationship management is intentionally restricted to the dedicated Secretariat endpoints; standard organization updates ignore the oversees field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants