diff --git a/README.md b/README.md
index 21179bcb5..5a4343fee 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ Please consult our [SECURITY.md](SECURITY.md) for specific instructions on repor
This project uses:
-- [Node.js](https://nodejs.org/) 24.22.1 for local development and the production image build; CI and the development Docker image use Node.js 24.
+- [Node.js](https://nodejs.org/) 24.22.3 for local development and the production image build; CI and the development Docker image use Node.js 24.
- [Express](https://github.com/expressjs)
- [MongoDB](https://www.mongodb.com/) replica sets for local development and testing
- [Amazon DocumentDB](https://aws.amazon.com/documentdb/) in production
@@ -85,7 +85,7 @@ See the [Docker README](docker/README.md) to run both the application and MongoD
##### Install dependencies
-Install Node.js 24.22.1 with its bundled npm, then install the application and migration dependencies:
+Install Node.js 24.22.3 with its bundled npm, then install the application and migration dependencies:
```sh
npm ci
@@ -197,6 +197,42 @@ The default local port is `8081`, configurable with `PORT`. Swagger UI is availa
to the database. API routes use the `/api/` prefix. The example `TEST_PORT=3001` gives the
integration suite a separate listener port. The full Docker setup uses port `3000`.
+### Root demo accounts
+
+Running `npm run populate:dev` resets the local development database and creates these active accounts:
+
+| Organization | Ordinary user | Administrator |
+| --- | --- | --- |
+| `top_root_1` | `top_root_1_user@demo.test` | `top_root_1_admin@demo.test` |
+| `root_1_4` | `root_1_4_user@demo.test` | `root_1_4_admin@demo.test` |
+
+All four accounts use the existing `LOCAL_KEY` API secret configured for local population. The population command prints this key. Administrators belong to both their organization's `users` and `admins` lists; ordinary users belong only to `users`.
+
+The demo hierarchy includes `top_root_1` → `root_1_4` → `window_1`. Both account types can read descendant organizations and users. With the local server running, replace `YOUR_LOCAL_KEY` with the printed secret to try an expanded organization read:
+
+```sh
+curl 'http://localhost:8081/api/registry/org/window_1?expand=users' \
+ -H 'CVE-API-ORG: top_root_1' \
+ -H 'CVE-API-USER: top_root_1_user@demo.test' \
+ -H 'CVE-API-KEY: YOUR_LOCAL_KEY'
+```
+
+Use the organization and username from either row above to try these requests:
+
+| Request | Expected result |
+| --- | --- |
+| `GET /api/registry/org` | The flat list and its pagination totals include the requesting Root and all its direct and indirect descendants. |
+| `GET /api/registry/org-hierarchy` | The requesting Root's subtree, with its ancestor path for context. |
+| `GET /api/registry/org/window_1` | The descendant organization's details. |
+| `GET /api/registry/org/window_1?expand=users` | The descendant organization with expanded user metadata. |
+| `GET /api/registry/org/window_1/users` | Users belonging to `window_1`. |
+| `GET /api/registry/org/window_1/user/ashleyruiz@window_1.com` | The specified descendant user. |
+| `GET /api/registry/org/top_root_2` | `403`: outside both Roots' oversight. |
+
+The `top_root_1` accounts can also read `root_1_4` and its users. The `root_1_4` accounts receive `403` when reading ancestor organization `top_root_1` or sibling Root `root_1_3`. Organization lists exclude those records as well. Secretariat continues to receive the complete organization list.
+
+Both demo administrators can grant or revoke `ADMIN` for users in `window_1`. Send `POST /api/registry/org/window_1/user/{username}/grant-role` or `POST /api/registry/org/window_1/user/{username}/revoke-role` with the JSON body `{"role":"ADMIN"}`. This permission covers the administrator's own Root and all its direct and indirect descendants. Attempting to revoke one's own `ADMIN` role returns `403`.
+
### API Documentation
Use the Swagger documentation for the instance you are calling:
diff --git a/api-docs/openapi.json b/api-docs/openapi.json
index 31d3ba81c..0023ed518 100644
--- a/api-docs/openapi.json
+++ b/api-docs/openapi.json
@@ -1,7 +1,7 @@
{
"openapi": "3.0.2",
"info": {
- "version": "2.9.4",
+ "version": "2.10.0",
"title": "CVE Services API",
"description": "The CVE Services API supports automation tooling for the CVE Program. Credentials are required for most service endpoints. Representatives of CVE Numbering Authorities (CNAs) should use one of the methods below to obtain credentials:
If your organization already has an Organizational Administrator (OA) account for the CVE Services, ask your admin for credentials
CVE data is to be in the JSON 5.2 CVE Record format. Details of the JSON 5.2 schema are located here.
Contact the CVE Services team",
"contact": {
@@ -3057,8 +3057,8 @@
"tags": [
"Data Registry — Organizations"
],
- "summary": "Retrieves all registry organizations (accessible to Secretariat)",
- "description": "
Related legacy endpoint:GET /org. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
User must belong to an organization with the Secretariat role
Expected Behavior
Secretariat: Retrieves information about all registry organizations
",
+ "summary": "Lists registry organizations for Secretariat or overseeing Root users",
+ "description": "
Related legacy endpoint:GET /org. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
Secretariat: Retrieves information about all registry organizations.
Root and top-level Root users: Retrieves a flat list containing the requesting organization itself and all direct and indirect descendants, including subordinate Roots and organizations beneath them. Ancestors, sibling branches, and unrelated organizations are excluded. A Root without descendants receives only its own organization.
Root users and administrators can read public conversation messages on their own organization. Descendant records omit the optional conversation field.
Results use existing non-Secretariat field filtering and are sorted by short_name. Pagination and totalCount apply only to organizations within the authorized scope. Authorization uses current ROOT authority and reporting relationships.
",
"operationId": "registryOrgAll",
"parameters": [
{
@@ -3076,7 +3076,7 @@
],
"responses": {
"200": {
- "description": "Returns information about all registry organizations, along with pagination fields if results span multiple pages of data",
+ "description": "Returns registry organizations and pagination metadata. Secretariat receives all organizations; Root users receive their own organization and descendants, with scoped totals.",
"content": {
"application/json": {
"schema": {
@@ -3251,8 +3251,8 @@
"tags": [
"Data Registry — Organizations"
],
- "summary": "Retrieves the complete registry organization hierarchy (Secretariat only)",
- "description": "
Access Control
User must belong to an organization with the Secretariat role.
Expected Behavior
Returns an unpaginated array of organization trees. Each node contains UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. Organizations without a parent appear at the top level, and leaves have an empty children array.
",
+ "summary": "Retrieves the organization hierarchy for Secretariat or Root users",
+ "description": "
Access Control
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
Secretariat receives the complete hierarchy. Root users receive their own subtree, including subordinate Roots and descendants, with only the ancestor path for context. Ancestors shown for context do not grant access to their organization or user records. Siblings and unrelated branches are excluded.
Returns an unpaginated array of organization trees. Each node contains UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. Organizations without a parent appear at the top level, and leaves have an empty children array.
",
"operationId": "registryOrgHierarchy",
"parameters": [
{
@@ -3267,7 +3267,7 @@
],
"responses": {
"200": {
- "description": "Returns the complete organization hierarchy with UUIDs, organization names, roles, role-specific flags, and nested children",
+ "description": "Returns the complete hierarchy for Secretariat or the requesting Root's scoped hierarchy, with UUIDs, names, roles, role-specific flags, and nested children",
"content": {
"application/json": {
"schema": {
@@ -3406,8 +3406,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Retrieves all users for the organization with the specified short name (accessible to same-organization users or Secretariat)",
- "description": "
Related legacy endpoint:GET /org/{shortname}/users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
Authenticated users can access this endpoint only for their own organization. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about users in the same organization
Secretariat: Retrieves all user information for any organization
",
+ "summary": "Retrieves all users for the organization with the specified short name (same-organization users, overseeing Root users, or Secretariat)",
+ "description": "
Related legacy endpoint:GET /org/{shortname}/users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
Authenticated users can access their own organization. Ordinary users and administrators in an organization with ROOT authority can also access direct and indirect descendants, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about users in the same organization
Secretariat: Retrieves all user information for any organization
",
"operationId": "registryOrgUsersAll",
"parameters": [
{
@@ -3707,14 +3707,14 @@
"tags": [
"Data Registry — Organizations"
],
- "summary": "Retrieves information about the registry organization specified by short name or UUID (accessible to same-organization users or Secretariat)",
- "description": "
Related legacy endpoint:GET /org/{shortname}. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
Authenticated users can access this endpoint only for their own organization. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves registry organization record for the specified shortname or UUID if it is the user's organization
Secretariat: Retrieves information about any registry organization
The reports_to, top_level_root, and oversees relationship fields contain organization short names.
The _hierarchy array contains the ancestor path from the top-level Root to the requested organization and that organization's complete subtree. Ancestors include only the child on that path. Nodes contain UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. An organization without a parent begins its own tree.
",
+ "summary": "Retrieves registry organization information by short name or UUID (same-organization users, overseeing Root users, or Secretariat)",
+ "description": "
Related legacy endpoint:GET /org/{shortname}. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
Authenticated users can access their own organization. Ordinary users and administrators in an organization with ROOT authority can also access direct and indirect descendants, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves registry organization record for the specified shortname or UUID if it is the user's organization
Secretariat: Retrieves information about any registry organization
Root users and administrators can read public conversation messages on their own organization. Descendant records omit the optional conversation field.
The reports_to, top_level_root, and oversees relationship fields contain organization short names.
The _hierarchy array contains the ancestor path from the top-level Root to the requested organization and that organization's complete subtree. Ancestors include only the child on that path and do not grant access to ancestor organization or user records. Siblings and unrelated branches remain outside Root oversight. Nodes contain UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. An organization without a parent begins its own tree.
",
"operationId": "registryOrgSingle",
"parameters": [
{
"name": "expand",
"in": "query",
- "description": "Optional expanded related data. Accepted value: users.",
+ "description": "Optional expanded related data. Accepted value: users. Overseeing Root users can expand the authorized target organization's users, administrators, and additional contacts. Existing Secretariat and same-organization expansion rules apply.",
"required": false,
"schema": {
"type": "string",
@@ -4009,8 +4009,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Retrieves information about a user for the specified username and organization short name (accessible to same-organization users or Secretariat)",
- "description": "
Related legacy endpoint:GET /org/{shortname}/user/{username}. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
Authenticated users can access this endpoint only for users in their own organization. Secretariat users can access any user.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about a registry user in the same organization
Secretariat: Retrieves any registry user's information
",
+ "summary": "Retrieves a user by username and organization short name (same-organization users, overseeing Root users, or Secretariat)",
+ "description": "
Related legacy endpoint:GET /org/{shortname}/user/{username}. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
Authenticated users can access users in their own organization. Ordinary users and administrators in an organization with ROOT authority can also access users belonging to direct and indirect descendant organizations, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any user. Root oversight excludes ancestors, sibling branches, and unrelated organizations.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about a registry user in the same organization
Secretariat: Retrieves any registry user's information
",
"operationId": "registryUserSingle",
"parameters": [
{
@@ -4109,8 +4109,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Updates information about a user for the specified username and organization shortname (accessible to self, same-organization Admins, or Secretariat)",
- "description": "
Related legacy endpoint:PUT /org/{shortname}/user/{username}. This endpoint accepts updates through a JSON request body. The legacy endpoint uses query parameters and the legacy user schema.
Access Control
Authenticated users can update their own name fields. Organization admins can update users in their organization. Secretariat users can update users in any organization.
Expected Behavior
Regular User: Updates the user's own information. Only name fields may be changed.
Admin User: Updates information about a user in the Admin's organization. Allowed to change all fields except org_short_name.
Secretariat: Updates information about a user in any organization. Allowed to change all fields.
Deactivation preserves assigned ADMIN membership while preventing authentication. Reactivation retains that assignment unless ADMIN was explicitly revoked or the user moved organizations. Omitting role from a profile update does not revoke ADMIN.
Moving a user to another organization removes ADMIN in both the source and destination. ADMIN requested in the move is not granted; promotion requires a separate authorized request after the move.
",
+ "summary": "Updates a user (self, same-organization Admins, overseeing Root Admins, or Secretariat)",
+ "description": "
Related legacy endpoint:PUT /org/{shortname}/user/{username}. This endpoint accepts updates through a JSON request body. The legacy endpoint uses query parameters and the legacy user schema.
Access Control
Authenticated users can update their own name fields. Organization admins can update users in their organization. Root admins can also update users in direct and indirect descendant organizations, including subordinate Roots. Secretariat users can update users in any organization.
Expected Behavior
Regular User: Updates the user's own information. Only name fields may be changed.
Admin User: Updates information about a user in the Admin's organization. Allowed to change all fields except org_short_name.
Secretariat: Updates information about a user in any organization. Allowed to change all fields.
Root Admin: May edit username, name, and status in a descendant organization. Use the grant-role and revoke-role endpoints for ADMIN changes. To move a user, both organizations must be within the Root's own subtree. When moving a user from a descendant organization, submit the current username, status, and all existing name fields. Submit profile changes in a separate request.
Deactivation preserves assigned ADMIN membership while preventing authentication. Reactivation retains that assignment unless ADMIN was explicitly revoked or the user moved organizations. Omitting role from a profile update does not revoke ADMIN.
Moving a user to another organization removes ADMIN in both the source and destination. ADMIN requested in the move is not granted; promotion requires a separate authorized request after the move.
",
"operationId": "registryUserUpdateSingle",
"parameters": [
{
@@ -4341,8 +4341,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Create a user with the provided short name as the owning organization (accessible to Secretariat or target organization Admin)",
- "description": "
Related legacy endpoint:POST /org/{shortname}/user. Uses the Data Registry user request schema, including the required status field. Compare the legacy request schema before switching.
Access Control
User must belong to an organization with the Secretariat role or be an Admin of the target organization
Expected Behavior
Admin User: Creates a user for the Admin's organization
Secretariat: Creates a user for any organization
",
+ "summary": "Create a user for an organization (accessible to Secretariat, target organization Admins, or overseeing Root Admins)",
+ "description": "
Related legacy endpoint:POST /org/{shortname}/user. Uses the Data Registry user request schema, including the required status field. Compare the legacy request schema before switching.
Access Control
User must belong to an organization with the Secretariat role, be an Admin of the target organization, or be an Admin of a Root that oversees the target organization.
Expected Behavior
Admin User: Creates a user for the Admin's organization
Root Admin: Creates regular or ADMIN users in its own organization or any descendant, including nested Roots. Ordinary Root users cannot create users.
Secretariat: Creates a user for any organization
",
"operationId": "registryUserCreateSingle",
"parameters": [
{
@@ -4451,8 +4451,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Reset the API key for a user (accessible to self, same-organization Admins, or Secretariat)",
- "description": "
Authenticated users can reset their own API secret. Organization admins can reset users in their organization. Secretariat users can reset any user's API secret.
Expected Behavior
Regular User: Resets user's own API secret
Admin User: Resets any user's API secret in the Admin's organization
Secretariat: Resets any user's API secret
",
+ "summary": "Reset the API key for a user (self, same-organization Admins, overseeing Root Admins, or Secretariat)",
+ "description": "
Authenticated users can reset their own API secret. Organization admins can reset users in their organization. Root admins can also reset users in direct and indirect descendant organizations, including subordinate Roots. Secretariat users can reset any user's API secret.
Expected Behavior
Regular User: Resets user's own API secret
Admin User: Resets any user's API secret in the Admin's organization
Root Admin: Resets any user's API secret in an organization the Root oversees
Secretariat: Resets any user's API secret
",
"operationId": "registryUserResetSecret",
"parameters": [
{
@@ -4764,8 +4764,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Grants a role to a user (accessible to Secretariat or Org Admin)",
- "description": "
Access Control
User must belong to an organization with the Secretariat role or be an Admin of the target organization
Expected Behavior
Admin User: Grants a role to a user in the Admin's organization
Secretariat: Grants a role to a user in any organization
",
+ "summary": "Grants the ADMIN role to a registry user",
+ "description": "
Access Control
Secretariat can grant ADMIN in any organization. Organization admins can grant ADMIN in their own organization. Root admins can also grant ADMIN in direct and indirect descendants, including subordinate Roots and their descendants.
",
"operationId": "registryUserGrantRole",
"parameters": [
{
@@ -4873,8 +4873,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Revokes a role from a user (accessible to Secretariat or Org Admin)",
- "description": "
Access Control
User must belong to an organization with the Secretariat role or be an Admin of the target organization
Expected Behavior
Admin User: Revokes a role from a user in the Admin's organization
Secretariat: Revokes a role from a user in any organization
",
+ "summary": "Revokes the ADMIN role from a registry user",
+ "description": "
Access Control
Secretariat can revoke ADMIN in any organization. Organization admins can revoke ADMIN in their own organization. Root admins can also revoke ADMIN in direct and indirect descendants, including subordinate Roots and their descendants. Attempts to revoke your own ADMIN role return HTTP 403.
",
"operationId": "registryUserRevokeRole",
"parameters": [
{
@@ -5122,8 +5122,8 @@
"tags": [
"Data Registry — Users"
],
- "summary": "Retrieves information about all registered users (accessible to Secretariat)",
- "description": "
Related legacy endpoint:GET /users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
User must belong to an organization with the Secretariat role
Expected Behavior
Secretariat: Retrieves information about all users for all organizations
",
+ "summary": "Lists registry users for Secretariat or overseeing Root users",
+ "description": "
Related legacy endpoint:GET /users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
Secretariat: Retrieves information about all users for all organizations.
Root and top-level Root users: Retrieves users belonging to the requesting organization itself and all direct and indirect descendant organizations, including subordinate Roots and organizations beneath them. Users in ancestors, sibling branches, and unrelated organizations are excluded. A Root without descendants receives its own organization's users.
Pagination and counts apply only to authorized users. Pagination metadata is included when the scoped user count reaches the page size. Authorization uses current ROOT authority and reporting relationships; user membership and administrator roles come from the requesting organization and its descendants. User secrets are excluded.
Related legacy endpoint:GET /org. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
-
User must belong to an organization with the Secretariat role
+
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
-
Secretariat: Retrieves information about all registry organizations
"
+
Secretariat: Retrieves information about all registry organizations.
+
Root and top-level Root users: Retrieves a flat list containing the requesting organization itself and all direct and indirect descendants, including subordinate Roots and organizations beneath them. Ancestors, sibling branches, and unrelated organizations are excluded. A Root without descendants receives only its own organization.
+
Root users and administrators can read public conversation messages on their own organization. Descendant records omit the optional conversation field.
+
Results use existing non-Secretariat field filtering and are sorted by short_name. Pagination and totalCount apply only to organizations within the authorized scope. Authorization uses current ROOT authority and reporting relationships.
"
#swagger.parameters['$ref'] = [
'#/components/parameters/pageQuery',
'#/components/parameters/apiEntityHeader',
@@ -32,7 +35,7 @@ router.get('/registry/org',
'#/components/parameters/apiSecretHeader'
]
#swagger.responses[200] = {
- description: 'Returns information about all registry organizations, along with pagination fields if results span multiple pages of data',
+ description: 'Returns registry organizations and pagination metadata. Secretariat receives all organizations; Root users receive their own organization and descendants, with scoped totals.',
content: {
"application/json": {
schema: {
@@ -84,12 +87,12 @@ router.get('/registry/org',
*/
mw.useRegistry(),
mw.validateUser,
- mw.onlySecretariat,
query().custom((query) => { return mw.validateQueryParameterNames(query, ['page']) }),
query(['page']).custom((val) => { return mw.containsNoInvalidCharacters(val) }),
query(['page']).optional().isInt({ min: CONSTANTS.PAGINATOR_PAGE }),
parseError,
parseGetParams,
+ mw.authorizeRegistryHierarchyRead,
registryOrgController.ALL_ORGS
)
@@ -97,15 +100,15 @@ router.get('/registry/org-hierarchy',
/*
#swagger.tags = ['Data Registry — Organizations']
#swagger.operationId = 'registryOrgHierarchy'
- #swagger.summary = 'Retrieves the complete registry organization hierarchy (Secretariat only)'
- #swagger.description = '
Access Control
User must belong to an organization with the Secretariat role.
Expected Behavior
Returns an unpaginated array of organization trees. Each node contains UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. Organizations without a parent appear at the top level, and leaves have an empty children array.
'
+ #swagger.summary = 'Retrieves the organization hierarchy for Secretariat or Root users'
+ #swagger.description = '
Access Control
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
Secretariat receives the complete hierarchy. Root users receive their own subtree, including subordinate Roots and descendants, with only the ancestor path for context. Ancestors shown for context do not grant access to their organization or user records. Siblings and unrelated branches are excluded.
Returns an unpaginated array of organization trees. Each node contains UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. Organizations without a parent appear at the top level, and leaves have an empty children array.
'
#swagger.parameters['$ref'] = [
'#/components/parameters/apiEntityHeader',
'#/components/parameters/apiUserHeader',
'#/components/parameters/apiSecretHeader'
]
#swagger.responses[200] = {
- description: 'Returns the complete organization hierarchy with UUIDs, organization names, roles, role-specific flags, and nested children',
+ description: 'Returns the complete hierarchy for Secretariat or the requesting Root\'s scoped hierarchy, with UUIDs, names, roles, role-specific flags, and nested children',
content: {
'application/json': {
schema: { $ref: '../schemas/registry-org/get-org-hierarchy-response.json' }
@@ -156,7 +159,7 @@ router.get('/registry/org-hierarchy',
*/
mw.useRegistry(),
mw.validateUser,
- mw.onlySecretariat,
+ mw.authorizeRegistryHierarchyRead,
registryOrgController.ORG_HIERARCHY
)
@@ -222,11 +225,11 @@ router.get('/registry/org/:shortname/users',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryOrgUsersAll'
- #swagger.summary = "Retrieves all users for the organization with the specified short name (accessible to same-organization users or Secretariat)"
+ #swagger.summary = "Retrieves all users for the organization with the specified short name (same-organization users, overseeing Root users, or Secretariat)"
#swagger.description = "
Related legacy endpoint:GET /org/{shortname}/users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
-
Authenticated users can access this endpoint only for their own organization. Secretariat users can access any organization.
+
Authenticated users can access their own organization. Ordinary users and administrators in an organization with ROOT authority can also access direct and indirect descendants, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about users in the same organization
Secretariat: Retrieves all user information for any organization
"
@@ -318,6 +321,7 @@ router.get('/registry/org/:shortname/users',
query(['page']).optional().isInt({ min: CONSTANTS.PAGINATOR_PAGE }),
parseError,
parseGetParams,
+ mw.authorizeRegistryOrgRead,
registryOrgController.USER_ALL)
router.get('/registry/org/:shortname/user_quota',
@@ -477,19 +481,20 @@ router.get('/registry/org/:identifier',
/*
#swagger.tags = ['Data Registry — Organizations']
#swagger.operationId = 'registryOrgSingle'
- #swagger.summary = "Retrieves information about the registry organization specified by short name or UUID (accessible to same-organization users or Secretariat)"
+ #swagger.summary = "Retrieves registry organization information by short name or UUID (same-organization users, overseeing Root users, or Secretariat)"
#swagger.description = "
Related legacy endpoint:GET /org/{shortname}. Data Registry responses use long_name and an authority array; legacy responses use name and authority.active_roles.
Access Control
-
Authenticated users can access this endpoint only for their own organization. Secretariat users can access any organization.
+
Authenticated users can access their own organization. Ordinary users and administrators in an organization with ROOT authority can also access direct and indirect descendants, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any organization.
Expected Behavior
Regular, CNA & Admin Users: Retrieves registry organization record for the specified shortname or UUID if it is the user's organization
Secretariat: Retrieves information about any registry organization
+
Root users and administrators can read public conversation messages on their own organization. Descendant records omit the optional conversation field.
The reports_to, top_level_root, and oversees relationship fields contain organization short names.
-
The _hierarchy array contains the ancestor path from the top-level Root to the requested organization and that organization's complete subtree. Ancestors include only the child on that path. Nodes contain UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. An organization without a parent begins its own tree.
"
+
The _hierarchy array contains the ancestor path from the top-level Root to the requested organization and that organization's complete subtree. Ancestors include only the child on that path and do not grant access to ancestor organization or user records. Siblings and unrelated branches remain outside Root oversight. Nodes contain UUID, short_name, long_name, authority, and children. ROOT nodes also contain is_top_level_root, and CNA nodes contain is_last_resort. An organization without a parent begins its own tree.
"
#swagger.parameters['expand'] = {
in: 'query',
- description: 'Optional expanded related data. Accepted value: users.',
+ description: 'Optional expanded related data. Accepted value: users. Overseeing Root users can expand the authorized target organization\'s users, administrators, and additional contacts. Existing Secretariat and same-organization expansion rules apply.',
required: false,
'@schema': {
type: 'string',
@@ -569,6 +574,7 @@ router.get('/registry/org/:identifier',
query(['expand']).optional().isIn(['users']),
parseError,
parseGetParams,
+ mw.authorizeRegistryOrgRead,
registryOrgController.SINGLE_ORG
)
@@ -576,11 +582,11 @@ router.get('/registry/org/:shortname/user/:username',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserSingle'
- #swagger.summary = "Retrieves information about a user for the specified username and organization short name (accessible to same-organization users or Secretariat)"
+ #swagger.summary = "Retrieves a user by username and organization short name (same-organization users, overseeing Root users, or Secretariat)"
#swagger.description = "
Related legacy endpoint:GET /org/{shortname}/user/{username}. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
-
Authenticated users can access this endpoint only for users in their own organization. Secretariat users can access any user.
+
Authenticated users can access users in their own organization. Ordinary users and administrators in an organization with ROOT authority can also access users belonging to direct and indirect descendant organizations, including organizations beneath subordinate Roots, using current reporting relationships. Secretariat users can access any user. Root oversight excludes ancestors, sibling branches, and unrelated organizations.
Expected Behavior
Regular, CNA & Admin Users: Retrieves information about a registry user in the same organization
Secretariat: Retrieves any registry user's information
"
@@ -655,6 +661,7 @@ router.get('/registry/org/:shortname/user/:username',
query().custom((query) => { return mw.validateQueryParameterNames(query, ['']) }),
parseError,
parseGetParams,
+ mw.authorizeRegistryOrgRead,
registryUserController.SINGLE_USER
)
@@ -965,13 +972,14 @@ router.post('/registry/org/:shortname/user',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserCreateSingle'
- #swagger.summary = "Create a user with the provided short name as the owning organization (accessible to Secretariat or target organization Admin)"
+ #swagger.summary = "Create a user for an organization (accessible to Secretariat, target organization Admins, or overseeing Root Admins)"
#swagger.description = "
Related legacy endpoint:POST /org/{shortname}/user. Uses the Data Registry user request schema, including the required status field. Compare the legacy request schema before switching.
Access Control
-
User must belong to an organization with the Secretariat role or be an Admin of the target organization
+
User must belong to an organization with the Secretariat role, be an Admin of the target organization, or be an Admin of a Root that oversees the target organization.
Expected Behavior
Admin User: Creates a user for the Admin's organization
+
Root Admin: Creates regular or ADMIN users in its own organization or any descendant, including nested Roots. Ordinary Root users cannot create users.
Secretariat: Creates a user for any organization
"
#swagger.requestBody = {
"required": true,
@@ -1073,15 +1081,16 @@ router.put('/registry/org/:shortname/user/:username',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserUpdateSingle'
- #swagger.summary = "Updates information about a user for the specified username and organization shortname (accessible to self, same-organization Admins, or Secretariat)"
+ #swagger.summary = "Updates a user (self, same-organization Admins, overseeing Root Admins, or Secretariat)"
#swagger.description = "
Related legacy endpoint:PUT /org/{shortname}/user/{username}. This endpoint accepts updates through a JSON request body. The legacy endpoint uses query parameters and the legacy user schema.
Access Control
-
Authenticated users can update their own name fields. Organization admins can update users in their organization. Secretariat users can update users in any organization.
+
Authenticated users can update their own name fields. Organization admins can update users in their organization. Root admins can also update users in direct and indirect descendant organizations, including subordinate Roots. Secretariat users can update users in any organization.
Expected Behavior
Regular User: Updates the user's own information. Only name fields may be changed.
Admin User: Updates information about a user in the Admin's organization. Allowed to change all fields except org_short_name.
Secretariat: Updates information about a user in any organization. Allowed to change all fields.
+
Root Admin: May edit username, name, and status in a descendant organization. Use the grant-role and revoke-role endpoints for ADMIN changes. To move a user, both organizations must be within the Root's own subtree. When moving a user from a descendant organization, submit the current username, status, and all existing name fields. Submit profile changes in a separate request.
Deactivation preserves assigned ADMIN membership while preventing authentication. Reactivation retains that assignment unless ADMIN was explicitly revoked or the user moved organizations. Omitting role from a profile update does not revoke ADMIN.
Moving a user to another organization removes ADMIN in both the source and destination. ADMIN requested in the move is not granted; promotion requires a separate authorized request after the move.
"
#swagger.parameters['shortname'] = { description: 'The shortname of the organization' }
@@ -1259,14 +1268,15 @@ router.put('/registry/org/:shortname/user/:username/reset_secret',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserResetSecret'
- #swagger.summary = "Reset the API key for a user (accessible to self, same-organization Admins, or Secretariat)"
+ #swagger.summary = "Reset the API key for a user (self, same-organization Admins, overseeing Root Admins, or Secretariat)"
#swagger.description = "
Authenticated users can reset their own API secret. Organization admins can reset users in their organization. Secretariat users can reset any user's API secret.
+
Authenticated users can reset their own API secret. Organization admins can reset users in their organization. Root admins can also reset users in direct and indirect descendant organizations, including subordinate Roots. Secretariat users can reset any user's API secret.
Expected Behavior
Regular User: Resets user's own API secret
Admin User: Resets any user's API secret in the Admin's organization
+
Root Admin: Resets any user's API secret in an organization the Root oversees
Secretariat: Resets any user's API secret
"
#swagger.parameters['shortname'] = { description: 'The shortname of the organization' }
#swagger.parameters['username'] = { description: 'The username of the user' }
@@ -1407,13 +1417,10 @@ router.post('/registry/org/:shortname/user/:username/grant-role',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserGrantRole'
- #swagger.summary = "Grants a role to a user (accessible to Secretariat or Org Admin)"
+ #swagger.summary = "Grants the ADMIN role to a registry user"
#swagger.description = "
Access Control
-
User must belong to an organization with the Secretariat role or be an Admin of the target organization
-
Expected Behavior
-
Admin User: Grants a role to a user in the Admin's organization
-
Secretariat: Grants a role to a user in any organization
"
+
Secretariat can grant ADMIN in any organization. Organization admins can grant ADMIN in their own organization. Root admins can also grant ADMIN in direct and indirect descendants, including subordinate Roots and their descendants.
"
#swagger.parameters['shortname'] = { description: 'The shortname of the organization' }
#swagger.parameters['username'] = { description: 'The username of the user' }
#swagger.parameters['$ref'] = [
@@ -1485,13 +1492,10 @@ router.post('/registry/org/:shortname/user/:username/revoke-role',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserRevokeRole'
- #swagger.summary = "Revokes a role from a user (accessible to Secretariat or Org Admin)"
+ #swagger.summary = "Revokes the ADMIN role from a registry user"
#swagger.description = "
Access Control
-
User must belong to an organization with the Secretariat role or be an Admin of the target organization
-
Expected Behavior
-
Admin User: Revokes a role from a user in the Admin's organization
-
Secretariat: Revokes a role from a user in any organization
"
+
Secretariat can revoke ADMIN in any organization. Organization admins can revoke ADMIN in their own organization. Root admins can also revoke ADMIN in direct and indirect descendants, including subordinate Roots and their descendants. Attempts to revoke your own ADMIN role return HTTP 403.
"
#swagger.parameters['shortname'] = { description: 'The shortname of the organization' }
#swagger.parameters['username'] = { description: 'The username of the user' }
#swagger.parameters['$ref'] = [
@@ -1684,13 +1688,15 @@ router.get('/registry/users',
/*
#swagger.tags = ['Data Registry — Users']
#swagger.operationId = 'registryUserAll'
- #swagger.summary = "Retrieves information about all registered users (accessible to Secretariat)"
+ #swagger.summary = "Lists registry users for Secretariat or overseeing Root users"
#swagger.description = "
Related legacy endpoint:GET /users. Data Registry responses expose status and role; legacy responses expose active and authority.active_roles.
Access Control
-
User must belong to an organization with the Secretariat role
+
User must belong to an organization with SECRETARIAT or ROOT authority. Both ordinary Root users and Root administrators have access.
Expected Behavior
-
Secretariat: Retrieves information about all users for all organizations
"
+
Secretariat: Retrieves information about all users for all organizations.
+
Root and top-level Root users: Retrieves users belonging to the requesting organization itself and all direct and indirect descendant organizations, including subordinate Roots and organizations beneath them. Users in ancestors, sibling branches, and unrelated organizations are excluded. A Root without descendants receives its own organization's users.
+
Pagination and counts apply only to authorized users. Pagination metadata is included when the scoped user count reaches the page size. Authorization uses current ROOT authority and reporting relationships; user membership and administrator roles come from the requesting organization and its descendants. User secrets are excluded.
"
#swagger.parameters['$ref'] = [
'#/components/parameters/pageQuery',
'#/components/parameters/apiEntityHeader',
@@ -1698,7 +1704,7 @@ router.get('/registry/users',
'#/components/parameters/apiSecretHeader'
]
#swagger.responses[200] = {
- description: 'Returns all users, along with pagination fields if results span multiple pages of data.',
+ description: 'Returns registry users: all users for Secretariat, or users in the requesting organization and its descendants for Roots. Pagination metadata is included when the authorized user count reaches the page size.',
content:{
"application/json":{
schema: {
@@ -1750,7 +1756,7 @@ router.get('/registry/users',
*/
mw.useRegistry(),
mw.validateUser,
- mw.onlySecretariat,
+ mw.authorizeRegistryHierarchyRead,
query().custom((query) => { return mw.validateQueryParameterNames(query, ['page']) }),
query(['page']).optional().isInt({ min: CONSTANTS.PAGINATOR_PAGE }),
query(['page']).custom((val) => { return mw.containsNoInvalidCharacters(val) }),
diff --git a/src/controller/registry.controller/org.error.js b/src/controller/registry.controller/org.error.js
index a0e314b02..cd973e28b 100644
--- a/src/controller/registry.controller/org.error.js
+++ b/src/controller/registry.controller/org.error.js
@@ -16,6 +16,13 @@ class RegistryOrgControllerError extends idrErr.IDRError {
return err
}
+ notOrgAdminOrSecretariatOrRoot () {
+ return {
+ ...this.notOrgAdminOrSecretariat(),
+ message: 'User creation requires Secretariat, an admin of the target organization, or an overseeing Root admin.'
+ }
+ }
+
orgDnePathParam (shortname) { // org
const err = {}
err.error = 'ORG_DNE_PARAM'
diff --git a/src/controller/registry.controller/org.registry.controller.js b/src/controller/registry.controller/org.registry.controller.js
index 3e31c8cf9..e78f5265f 100644
--- a/src/controller/registry.controller/org.registry.controller.js
+++ b/src/controller/registry.controller/org.registry.controller.js
@@ -16,6 +16,7 @@ const { getUserQuotaUsage } = require('../../utils/userQuota')
const { deepRemoveEmpty } = require('../../utils/utils')
const { normalizeOrgCveWebsiteUpdateDate } = require('../../utils/dateOnly')
const { normalizeReviewOrgData } = require('../../repositories/baseOrgRepositoryHelpers')
+const NON_SECRETARIAT_CONVERSATION_FIELDS = ['__v', '_id', 'UUID', 'previous_conversation_uuid', 'next_conversation_uuid', 'target_uuid', 'visibility']
function addUUIDsToSet (uuidSet, values) {
if (!Array.isArray(values)) return
@@ -113,14 +114,23 @@ function removeAdditionalContactUUIDFields (org) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent.
- * @description This endpoint is accessible to Secretariat only. It retrieves a list of all registry organizations.
+ * @description Secretariat receives all registry organizations; Root users receive their own organization and descendants.
* Called by GET /api/registry/org
*/
async function getAllOrgs (req, res, next) {
try {
+ const access = req.ctx.registryRead
+ if (!access || (!access.isSecretariat && !access.hierarchyScope)) {
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
const repo = req.ctx.repositories.getBaseOrgRepository()
+ const { isSecretariat, hierarchyScope } = access
+ const descendantOrgUUIDs = isSecretariat ? undefined : await authContext.getRequestOrgDescendantUUIDs(req, repo, hierarchyScope)
+ if (!isSecretariat && !Array.isArray(descendantOrgUUIDs)) {
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
+ const orgUUIDs = isSecretariat ? undefined : [hierarchyScope, ...descendantOrgUUIDs]
const conversationRepo = req.ctx.repositories.getConversationRepository()
- const isSecretariat = await authContext.isRequesterSecretariat(req, repo)
const CONSTANTS = getConstants()
let returnValue
@@ -135,10 +145,16 @@ async function getAllOrgs (req, res, next) {
options.page = req.ctx.query.page ? parseInt(req.ctx.query.page) : CONSTANTS.PAGINATOR_PAGE // if 'page' query parameter is not defined, set 'page' to the default page value
try {
- returnValue = await repo.getAllOrgs({ ...options }, REGISTRY_FORMAT, isSecretariat)
- for (let i = 0; i < returnValue.organizations.length; i++) {
- const conversation = await conversationRepo.getAllByTargetUUID(returnValue.organizations[i].UUID, isSecretariat)
- returnValue.organizations[i].conversation = conversation?.length ? conversation : undefined
+ returnValue = await repo.getAllOrgs({ ...options }, REGISTRY_FORMAT, isSecretariat, orgUUIDs)
+ for (const org of returnValue.organizations) {
+ if (!isSecretariat && org.UUID !== hierarchyScope) {
+ delete org.conversation
+ continue
+ }
+ const conversation = await conversationRepo.getAllByTargetUUID(org.UUID, isSecretariat)
+ org.conversation = conversation?.length
+ ? (isSecretariat ? conversation : conversation.map(c => _.omit(c, NON_SECRETARIAT_CONVERSATION_FIELDS)))
+ : undefined
}
} catch (error) {
// Handle the specific error thrown by BaseOrgRepository.createOrg
@@ -156,13 +172,17 @@ async function getAllOrgs (req, res, next) {
}
/**
- * Retrieves the complete registry organization hierarchy for Secretariat users.
+ * Retrieves the complete hierarchy for Secretariat or the requesting Root's branch.
* Called by GET /api/registry/org-hierarchy.
*/
async function getOrgHierarchy (req, res, next) {
try {
const repo = req.ctx.repositories.getBaseOrgRepository()
- const hierarchy = await repo.getOrgHierarchy()
+ const access = req.ctx.registryRead
+ if (!access || (!access.isSecretariat && !access.hierarchyScope)) {
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
+ const hierarchy = await authContext.getRequestOrgHierarchy(req, repo, access.hierarchyScope)
return res.status(200).json(hierarchy)
} catch (err) {
if (res.headersSent) return next(err)
@@ -248,7 +268,7 @@ async function getActiveCnas (req, res, next) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent.
- * @description This endpoint is accessible to Secretariat only. It retrieves information about the specified registry organization.
+ * @description Accessible to Secretariat, same-organization users, and overseeing Root users.
* Called by GET /api/registry/org/:identifier
*/
async function getOrg (req, res, next) {
@@ -261,47 +281,45 @@ async function getOrg (req, res, next) {
let returnValue
try {
- const requesterOrg = await authContext.getRequesterOrg(req, repo)
- const isSecretariat = await authContext.isRequesterSecretariat(req, repo)
- const isRequesterSameOrg = identifierIsUUID
- ? requesterOrg.UUID === identifier
- : await authContext.isRequesterSameOrg(req, repo, identifier)
-
- if (!isRequesterSameOrg && !isSecretariat) {
- logger.info({ uuid: req.ctx.uuid, message: identifier + ' organization can only be viewed by the users of the same organization or the Secretariat.' })
+ const access = req.ctx.registryRead
+ if (!access) {
return res.status(403).json(error.notSameOrgOrSecretariat())
}
- returnValue = await repo.getOrg(identifier, identifierIsUUID, {}, REGISTRY_FORMAT, isSecretariat)
+ const { isSecretariat, targetOrg, reason } = access
+ const isParentOrg = reason === 'PARENT_ORG'
+ returnValue = await repo.getOrg(targetOrg?.UUID || identifier, Boolean(targetOrg?.UUID) || identifierIsUUID, {}, REGISTRY_FORMAT, isSecretariat)
if (returnValue) {
- returnValue._hierarchy = returnValue.UUID ? await repo.getOrgHierarchy(returnValue.UUID) : []
+ returnValue._hierarchy = returnValue.UUID ? await authContext.getRequestOrgHierarchy(req, repo, returnValue.UUID) : []
let userRepo
let isAdminOfRequestedOrg = false
- if (!isSecretariat) {
+ if (!isSecretariat && !isParentOrg) {
userRepo = req.ctx.repositories.getBaseUserRepository()
isAdminOfRequestedOrg = await userRepo.isAdmin(req.ctx.user, returnValue.short_name, {})
}
- // fetch conversation
- const conversation = await conversationRepo.getAllByTargetUUID(returnValue.UUID, isSecretariat)
- if (isSecretariat) {
- returnValue.conversation = conversation?.length ? _.map(conversation, c => _.omit(c, ['__v', '_id', 'previous_conversation_uuid', 'next_conversation_uuid', 'target_uuid'])) : undefined
+ if (isSecretariat || reason === 'SAME_ORG') {
+ const conversation = await conversationRepo.getAllByTargetUUID(returnValue.UUID, isSecretariat)
+ const fieldsToOmit = isSecretariat
+ ? ['__v', '_id', 'previous_conversation_uuid', 'next_conversation_uuid', 'target_uuid']
+ : NON_SECRETARIAT_CONVERSATION_FIELDS
+ returnValue.conversation = conversation?.length ? conversation.map(c => _.omit(c, fieldsToOmit)) : undefined
} else {
- returnValue.conversation = conversation?.length ? _.map(conversation, c => _.omit(c, ['__v', '_id', 'UUID', 'previous_conversation_uuid', 'next_conversation_uuid', 'target_uuid', 'visibility'])) : undefined
+ delete returnValue.conversation
}
if (req.ctx.query?.expand === 'users') {
userRepo = userRepo || req.ctx.repositories.getBaseUserRepository()
if (isSecretariat) {
returnValue._userMap = await buildUserMap(returnValue, userRepo, repo)
- } else if (isAdminOfRequestedOrg) {
- returnValue._userMap = await buildOrgUserMap(requesterOrg, userRepo, repo)
+ } else if (isAdminOfRequestedOrg || isParentOrg) {
+ returnValue._userMap = await buildOrgUserMap(targetOrg, userRepo, repo)
}
}
if (!isSecretariat) {
- if (!isAdminOfRequestedOrg) {
+ if (!isAdminOfRequestedOrg && !isParentOrg) {
removeUserUUIDFields(returnValue)
}
}
@@ -1010,7 +1028,7 @@ async function removeOverseeRelationship (req, res, next) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent. Registry-format responses include 'role' for admins.
- * @description This endpoint is accessible to Secretariat only. It retrieves user information for any organization.
+ * @description Accessible to Secretariat, same-organization users, and overseeing Root users.
* Called by GET /api/registry/org/:shortname/users
*/
async function getUsers (req, res, next) {
@@ -1027,26 +1045,15 @@ async function getUsers (req, res, next) {
options.sort = { username: 'asc' }
options.page = req.ctx.query.page ? parseInt(req.ctx.query.page) : CONSTANTS.PAGINATOR_PAGE // if 'page' query parameter is not defined, set 'page' to the default page value
const orgShortName = req.ctx.params.shortname
- const orgRepo = req.ctx.repositories.getBaseOrgRepository()
const userRepo = req.ctx.repositories.getBaseUserRepository()
- const orgUUID = await orgRepo.getOrgUUID(orgShortName)
- const isSecretariat = await authContext.isRequesterSecretariat(req, orgRepo)
-
- if (!orgUUID) {
- logger.info({ uuid: req.ctx.uuid, message: orgShortName + ' organization does not exist.' })
- return res.status(404).json(error.orgDnePathParam(orgShortName))
- }
-
- const isSameOrg = await authContext.isRequesterSameOrg(req, orgRepo, { UUID: orgUUID, short_name: orgShortName })
- if (!isSameOrg && !isSecretariat) {
- logger.info({ uuid: req.ctx.uuid, message: orgShortName + ' organization can only be viewed by the users of the same organization or the Secretariat.' })
+ const org = req.ctx.registryRead?.targetOrg
+ if (!org) {
return res.status(403).json(error.notSameOrgOrSecretariat())
}
- const payload = await userRepo.getAllUsersByOrgShortname(orgShortName, options)
+ const payload = await userRepo.getAllUsersByOrgShortname(org.short_name, options, org)
// Hydrate the role field for registry responses.
- const org = await orgRepo.findOneByShortName(orgShortName)
payload.users.forEach(user => {
user.role = org.admins.includes(user.UUID) ? 'ADMIN' : user.role // Default to existing role if not admin
})
@@ -1067,7 +1074,7 @@ async function getUsers (req, res, next) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent.
- * @description This endpoint is accessible to Secretariat only. It creates a user for any organization.
+ * @description Secretariat, target organization admins, and overseeing Root admins can create users.
* Called by POST /api/registry/org/:shortname/user
*/
async function createUserByOrg (req, res, next) {
@@ -1118,9 +1125,12 @@ async function createUserByOrg (req, res, next) {
const isRequesterSecretariat = await authContext.isRequesterSecretariat(req, orgRepo, { session })
const isRequesterAdminOfTargetOrg = await authContext.isRequesterAdminOfOrg(req, userRepo, orgRepo, orgShortName, { session })
- if (!isRequesterSecretariat && !isRequesterAdminOfTargetOrg) {
+ const isOverseeingRootAdmin = !isRequesterSecretariat && !isRequesterAdminOfTargetOrg &&
+ await authContext.isRequesterRootAdminOfOrgs(req, userRepo, orgRepo,
+ [await orgRepo.findOneByShortName(orgShortName, { session }, REGISTRY_FORMAT)], { session })
+ if (!isRequesterSecretariat && !isRequesterAdminOfTargetOrg && !isOverseeingRootAdmin) {
await session.abortTransaction()
- return res.status(403).json(error.notOrgAdminOrSecretariat()) // The Admin user must belong to the new user's organization
+ return res.status(403).json(error.notOrgAdminOrSecretariatOrRoot())
}
const requestingUserUUID = await authContext.getRequesterUserUUID(req, userRepo, orgRepo, { session })
diff --git a/src/controller/registry.controller/user.registry.controller.js b/src/controller/registry.controller/user.registry.controller.js
index 231f620cc..29b0e2b09 100644
--- a/src/controller/registry.controller/user.registry.controller.js
+++ b/src/controller/registry.controller/user.registry.controller.js
@@ -26,11 +26,28 @@ function removeImmutableUpdateFields (body) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent. Registry-format responses include 'role' for admins.
- * @description This endpoint is accessible to Secretariat only. It retrieves a list of all registry users.
+ * @description Secretariat receives all registry users; Root users receive users in their own and descendant organizations.
* Called by GET /api/registry/users
*/
async function getAllUsers (req, res, next) {
try {
+ const access = req.ctx.registryRead
+ if (!access || (!access.isSecretariat && !access.hierarchyScope)) {
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
+ const orgRepo = req.ctx.repositories.getBaseOrgRepository()
+ const { isSecretariat, hierarchyScope } = access
+ let userUUIDs
+ const adminUUIDs = new Set()
+ if (!isSecretariat) {
+ const descendantOrgUUIDs = await authContext.getRequestOrgDescendantUUIDs(req, orgRepo, hierarchyScope)
+ if (!Array.isArray(descendantOrgUUIDs)) {
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
+ const orgs = await orgRepo.findOrgsByUUIDs([hierarchyScope, ...descendantOrgUUIDs], { readPreference: 'primary' })
+ userUUIDs = [...new Set(orgs.flatMap(org => org.users || []))]
+ orgs.forEach(org => (org.admins || []).forEach(UUID => adminUUIDs.add(UUID)))
+ }
const CONSTANTS = getConstants()
const repo = req.ctx.repositories.getBaseUserRepository()
@@ -44,33 +61,25 @@ async function getAllUsers (req, res, next) {
options.sort = { short_name: 'asc' }
options.page = req.ctx.query.page ? parseInt(req.ctx.query.page) : CONSTANTS.PAGINATOR_PAGE // if 'page' query parameter is not defined, set 'page' to the default page value
- const returnValue = await repo.getAllUsers(options)
- // Hydrate roles
- const orgRepo = req.ctx.repositories.getBaseOrgRepository()
- const distinctOrgUUIDs = [...new Set(returnValue.users.map(u => u.org_UUID))]
-
- // Fetch all relevant orgs in one go (or in parallel) if possible, but map is easy for now
- // Since we don't have a "getManyOrgsByUUID", we might need to do it one by one or improve repository
- // For now, let's iterate and fetch. It's not optimal but safe given repo limitations.
- // Optimization: We can build a map of orgUUID -> orgObject
- const orgMap = {}
- for (const uuid of distinctOrgUUIDs) {
- // We need the org content to get admins
- const org = await orgRepo.findOneByUUID(uuid, {}, REGISTRY_FORMAT)
- if (org) {
- orgMap[uuid] = org
+ const returnValue = await repo.getAllUsers(options, userUUIDs)
+ if (isSecretariat) {
+ // Preserve the existing Secretariat role mapping.
+ const distinctOrgUUIDs = [...new Set(returnValue.users.map(u => u.org_UUID))]
+ const orgMap = {}
+ for (const uuid of distinctOrgUUIDs) {
+ const org = await orgRepo.findOneByUUID(uuid, {}, REGISTRY_FORMAT)
+ if (org) orgMap[uuid] = org
}
+ returnValue.users.forEach(user => {
+ if (orgMap[user.org_UUID]?.admins?.includes(user.UUID)) adminUUIDs.add(user.UUID)
+ })
}
returnValue.users.forEach(user => {
- const org = orgMap[user.org_UUID]
- if (org && org.admins && org.admins.includes(user.UUID)) {
- user.role = 'ADMIN'
- }
- // If not admin, leave as is (undefined or empty or whatever it was)
+ if (adminUUIDs.has(user.UUID)) user.role = 'ADMIN'
})
- logger.info({ uuid: req.ctx.uuid, message: 'The user information was sent to the secretariat user.' })
+ logger.info({ uuid: req.ctx.uuid, message: 'The authorized registry user information was sent to the user.' })
return res.status(200).json(returnValue)
} catch (err) {
next(err)
@@ -86,7 +95,7 @@ async function getAllUsers (req, res, next) {
* @param {object} res - The Express response object.
* @param {function} next - The next middleware function.
* @returns {Promise} - A promise that resolves when the response is sent. Registry-format responses include 'role' for admins.
- * @description This endpoint is accessible to Secretariat only. It retrieves information about the specified registry user.
+ * @description Accessible to Secretariat, same-organization users, and overseeing Root users.
* Called by GET /api/registry/org/:shortname/user/:username
*/
async function getUser (req, res, next) {
@@ -112,7 +121,9 @@ async function getUser (req, res, next) {
const userRepo = req.ctx.repositories.getBaseUserRepository()
const repo = req.ctx.repositories.getBaseOrgRepository()
- const isSecretariat = await authContext.isRequesterSecretariat(req, repo, {}, REGISTRY_FORMAT)
+ const isSecretariat = identifier
+ ? await authContext.isRequesterSecretariat(req, repo, {}, REGISTRY_FORMAT)
+ : req.ctx.registryRead?.isSecretariat
let result
let org
@@ -137,15 +148,13 @@ async function getUser (req, res, next) {
username: result.username
}
} else {
- org = await repo.findOneByShortName(req.ctx.params.shortname, {}, REGISTRY_FORMAT)
-
- const isSameOrg = await authContext.isRequesterSameOrg(req, repo, org, {}, REGISTRY_FORMAT)
- if (!isSecretariat && !isSameOrg) {
- logger.info({ uuid: req.ctx.uuid, message: userToGetParameters.org + ' organization can only be viewed by the users of the same organization or the Secretariat.' })
+ if (!req.ctx.registryRead) {
return res.status(403).json(error.notSameOrgOrSecretariat())
}
-
- result = await userRepo.findOneByUsernameAndOrgShortname(userToGetParameters.username, userToGetParameters.org, {}, REGISTRY_FORMAT)
+ org = req.ctx.registryRead.targetOrg
+ result = org
+ ? await userRepo.findUserByUsernameAndOrgUUID(userToGetParameters.username, org.UUID, { readPreference: 'primary' }, REGISTRY_FORMAT)
+ : null
if (!result) {
logger.info({ uuid: req.ctx.uuid, message: userToGetParameters.username + ' user could not be found.' })
return res.status(404).json(error.userDne(userToGetParameters.username))
@@ -205,11 +214,6 @@ async function updateUser (req, res, next) {
return res.status(400).json(error.secretUpdateNotAllowed())
}
- const requestingUserParameters = {
- org: req.ctx.org,
- username: req.ctx.user
- }
-
const userToEditParameters = {
org: req.ctx.params.shortname,
username: req.ctx.params.username
@@ -217,9 +221,6 @@ async function updateUser (req, res, next) {
const isSecretariat = await authContext.isRequesterSecretariat(req, orgRepo, {}, REGISTRY_FORMAT)
- // TODO: This will need to be atomic at some point like revoke or grant
- // Specific check for org_short_name (Secretariat only)
-
let userToEdit
let org
if (identifier) {
@@ -263,9 +264,12 @@ async function updateUser (req, res, next) {
}
}
+ let isRootMove = false
if (body.org_short_name && !isSecretariat) {
- logger.info({ uuid: req.ctx.uuid, message: 'Only Secretariat can reassign user organization.' })
- return res.status(403).json(error.notAllowedToChangeOrganization())
+ isRootMove = await authContext.isRequesterRootAdminOfOrgs(req, userRepo, orgRepo, [org])
+ if (!isRootMove) {
+ return res.status(403).json(error.notAllowedToChangeOrganization())
+ }
}
if (body.org_short_name) {
@@ -276,7 +280,7 @@ async function updateUser (req, res, next) {
}
}
- if (body.org_short_name && isSecretariat && userToEditParameters.org === org.short_name && body.org_short_name === org.short_name) {
+ if (body.org_short_name && (isSecretariat || isRootMove) && userToEditParameters.org === org.short_name && body.org_short_name === org.short_name) {
logger.info({ uuid: req.ctx.uuid, message: `User ${userToEditParameters.username} is already in organization ${userToEditParameters.org}.` })
return res.status(403).json(error.alreadyInOrg(org.short_name, userToEditParameters.username))
}
@@ -287,31 +291,7 @@ async function updateUser (req, res, next) {
}
const requesterSameOrg = await authContext.isRequesterSameOrg(req, orgRepo, org, {}, REGISTRY_FORMAT)
- if (!isSecretariat && !isAdmin && !requesterSameOrg) {
- logger.info({ uuid: req.ctx.uuid, message: requestingUserParameters.org + ' user can only be updated by the user or admins of the same organization or the Secretariat.' })
- return res.status(403).json(error.notSameOrgOrSecretariat())
- }
-
- if (!isSecretariat && !isAdmin) {
- if (requesterUserUUID !== userToEdit?.UUID) {
- if (!userToEdit) {
- logger.info({ uuid: req.ctx.uuid, message: 'User DNE' })
- return res.status(404).json(error.userDne(userToEditParameters.username))
- }
- logger.info({ uuid: req.ctx.uuid, message: 'Not same user or secretariat' })
- return res.status(403).json(error.notSameUserOrSecretariat())
- }
- }
-
- if (!org) {
- logger.info({ uuid: req.ctx.uuid, message: `Target organization ${userToEditParameters.org} does not exist.` })
- return res.status(404).json(error.orgDnePathParam(userToEditParameters.org))
- }
-
- if (!userToEdit) {
- logger.info({ uuid: req.ctx.uuid, message: userToEditParameters.username + ' user could not be found.' })
- return res.status(404).json(error.userDne(userToEditParameters.username))
- }
+ const requiresProfileAuthorization = !isSecretariat && !isAdmin && !isRootMove
let result
let updatedUser
let updatedUserUUID
@@ -319,8 +299,55 @@ async function updateUser (req, res, next) {
try {
session.startTransaction({ readPreference: 'primary' })
- // if a user is NOT an ADMIN OR SECRETARIAT they can only update their name fields
- if (!isSecretariat && !isAdmin) {
+ if (requiresProfileAuthorization && !requesterSameOrg) {
+ const overseesOrg = await authContext.isRequesterRootAdminOfOrgs(req, userRepo, orgRepo, [org], { session })
+ if (!overseesOrg || (userToEdit && await orgRepo.getOrgUUIDByUserUUID(userToEdit.UUID, { session }) !== org.UUID)) {
+ logger.info({ uuid: req.ctx.uuid, message: 'Profile update denied for the target organization.' })
+ await session.abortTransaction()
+ return res.status(403).json(error.notSameOrgOrSecretariat())
+ }
+ }
+
+ if (!userToEdit) {
+ logger.info({ uuid: req.ctx.uuid, message: userToEditParameters.username + ' user could not be found.' })
+ await session.abortTransaction()
+ return res.status(404).json(error.userDne(userToEditParameters.username))
+ }
+
+ if (isRootMove) {
+ // The source may have changed after initial lookup. Recheck membership and
+ // both endpoints in the same snapshot used by updateUserFull.
+ const currentOrgUUID = await orgRepo.getOrgUUIDByUserUUID(userToEdit.UUID, { session })
+ const targetOrg = await orgRepo.findOneByShortName(body.org_short_name, { session }, REGISTRY_FORMAT)
+ if (currentOrgUUID !== org.UUID ||
+ !await authContext.isRequesterRootAdminOfOrgs(req, userRepo, orgRepo, [org, targetOrg], { session })) {
+ await session.abortTransaction()
+ return res.status(403).json(error.notAllowedToChangeOrganization())
+ }
+
+ const isSourceAdmin = await authContext.isRequesterAdminOfOrg(req, userRepo, orgRepo, org, { session }, REGISTRY_FORMAT)
+ if (!isSourceAdmin) {
+ const currentUser = await userRepo.findUserByUUID(userToEdit.UUID, { session }, REGISTRY_FORMAT)
+ const profileFields = ['username', 'status', 'name']
+ const currentProfile = _.pick(JSON.parse(JSON.stringify(currentUser)), profileFields)
+ // Compare every effective update, including dotted paths such as name.first.
+ // Identity fields are normalized above; move role fields and legacy active
+ // are ignored by the existing registry repository.
+ const incomingProfile = _.omit(body, ['org_short_name', 'role', 'authority', 'active', 'UUID', 'uuid', 'org_UUID', 'org_uuid'])
+ if (!_.isEqual(incomingProfile, currentProfile)) {
+ await session.abortTransaction()
+ return res.status(400).json(error.rootMoveProfileChange())
+ }
+ }
+ }
+
+ if (requiresProfileAuthorization && requesterSameOrg) {
+ if (requesterUserUUID !== userToEdit.UUID) {
+ logger.info({ uuid: req.ctx.uuid, message: 'Not same user or secretariat' })
+ await session.abortTransaction()
+ return res.status(403).json(error.notSameUserOrSecretariat())
+ }
+
const allowedFields = ['name', 'name.first', 'name.last', 'name.middle', 'name.suffix']
const restrictedUpdates = _.omit(body, allowedFields)
@@ -436,6 +463,18 @@ async function deleteUser (req, res, next) {
}
}
+async function getRoleChangeAuthorizationError (req, userRepo, orgRepo, targetOrg, options) {
+ if (await authContext.isRequesterSecretariat(req, orgRepo, options, REGISTRY_FORMAT)) return null
+
+ if (await authContext.isRequesterSameOrg(req, orgRepo, targetOrg, options, REGISTRY_FORMAT)) {
+ const isAdmin = await authContext.isRequesterAdminOfOrg(req, userRepo, orgRepo, targetOrg, options, REGISTRY_FORMAT)
+ return isAdmin ? null : error.notOrgAdminOrSecretariatUpdate()
+ }
+
+ const isOverseeingRootAdmin = await authContext.isRequesterRootAdminOfOrgs(req, userRepo, orgRepo, [targetOrg], options)
+ return isOverseeingRootAdmin ? null : error.notSameOrgOrSecretariat()
+}
+
async function grantRole (req, res, next) {
// Explicitly configuring causalConsistency flag for clear DocumentDB context documentation
try {
@@ -466,19 +505,11 @@ async function grantRole (req, res, next) {
return res.status(404).json(error.orgDnePathParam(orgShortName))
}
- const isSecretariat = await authContext.isRequesterSecretariat(req, orgRepo, { session }, REGISTRY_FORMAT)
const targetOrg = { UUID: targetOrgUUID, short_name: orgShortName }
-
- const requesterSameOrg = await authContext.isRequesterSameOrg(req, orgRepo, targetOrg, { session }, REGISTRY_FORMAT)
- if (!requesterSameOrg && !isSecretariat) {
+ const denial = await getRoleChangeAuthorizationError(req, userRepo, orgRepo, targetOrg, { session })
+ if (denial) {
await session.abortTransaction()
- return res.status(403).json(error.notSameOrgOrSecretariat())
- }
-
- const isAdmin = await authContext.isRequesterAdminOfOrg(req, userRepo, orgRepo, targetOrg, { session }, REGISTRY_FORMAT)
- if (!isSecretariat && !isAdmin) {
- await session.abortTransaction()
- return res.status(403).json(error.notOrgAdminOrSecretariatUpdate())
+ return res.status(403).json(denial)
}
// Check if target user exists in target org
@@ -541,19 +572,11 @@ async function revokeRole (req, res, next) {
return res.status(404).json(error.orgDnePathParam(orgShortName))
}
- const isSecretariat = await authContext.isRequesterSecretariat(req, orgRepo, { session }, REGISTRY_FORMAT)
const targetOrg = { UUID: targetOrgUUID, short_name: orgShortName }
-
- const requesterSameOrg = await authContext.isRequesterSameOrg(req, orgRepo, targetOrg, { session }, REGISTRY_FORMAT)
- if (!requesterSameOrg && !isSecretariat) {
- await session.abortTransaction()
- return res.status(403).json(error.notSameOrgOrSecretariat())
- }
-
- const isAdmin = await authContext.isRequesterAdminOfOrg(req, userRepo, orgRepo, targetOrg, { session }, REGISTRY_FORMAT)
- if (!isSecretariat && !isAdmin) {
+ const denial = await getRoleChangeAuthorizationError(req, userRepo, orgRepo, targetOrg, { session })
+ if (denial) {
await session.abortTransaction()
- return res.status(403).json(error.notOrgAdminOrSecretariatUpdate())
+ return res.status(403).json(denial)
}
// Check if target user exists in target org
diff --git a/src/controller/user.controller/error.js b/src/controller/user.controller/error.js
index 75fa8581c..f874f1714 100644
--- a/src/controller/user.controller/error.js
+++ b/src/controller/user.controller/error.js
@@ -11,7 +11,7 @@ class UserControllerError extends idrErr.IDRError {
notAllowedToChangeOrganization () {
const err = {}
err.error = 'NOT_ALLOWED_TO_CHANGE_ORGANIZATION'
- err.message = 'Only the Secretariat can change the organization for a user.'
+ err.message = 'User moves require Secretariat or a Root admin with both organizations in their hierarchy.'
return err
}
@@ -23,6 +23,13 @@ class UserControllerError extends idrErr.IDRError {
}
}
+ rootMoveProfileChange () {
+ return {
+ error: 'NOT_ALLOWED_TO_CHANGE_FIELD',
+ message: 'Root move permission does not allow profile changes. Supply the existing username, status, and name fields unchanged.'
+ }
+ }
+
orgDnePathParam (shortname) { // org
const err = {}
err.error = 'ORG_DNE_PARAM'
diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js
index 249659161..c476d0259 100644
--- a/src/middleware/middleware.js
+++ b/src/middleware/middleware.js
@@ -225,6 +225,68 @@ async function onlySecretariat (req, res, next) {
}
}
+// Read authorization is deliberately separate from same-org and administrator write checks.
+async function authorizeRegistryOrgRead (req, res, next) {
+ try {
+ if (!req.ctx.authenticated || !req.ctx.orgUUID) {
+ return res.status(403).json(registryOrgErrors.notSameOrgOrSecretariat())
+ }
+ const repo = req.ctx.repositories.getBaseOrgRepository()
+ const { identifier, shortname, username } = req.ctx.params
+ const options = { readPreference: 'primary' }
+ const targetOrg = identifier && uuid.validate(identifier)
+ ? await repo.findOneByUUID(identifier, options)
+ : await repo.findOneByShortName(identifier || shortname, options)
+
+ // Preserve the organization-user list's existing missing-organization response.
+ if (!targetOrg && !identifier && !username) {
+ return res.status(404).json(registryOrgErrors.orgDnePathParam(shortname))
+ }
+
+ const isSecretariat = await authContext.isRequesterSecretariat(req, repo, options)
+ let reason
+ if (isSecretariat) {
+ reason = 'SECRETARIAT'
+ } else if (await authContext.isRequesterSameOrg(req, repo, targetOrg)) {
+ reason = 'SAME_ORG'
+ } else if (await authContext.isRequesterParentOrg(req, repo, targetOrg)) {
+ reason = 'PARENT_ORG'
+ } else {
+ return res.status(403).json(registryOrgErrors.notSameOrgOrSecretariat())
+ }
+
+ req.ctx.registryRead = { targetOrg, isSecretariat, reason }
+ next()
+ } catch (err) {
+ next(err)
+ }
+}
+
+async function authorizeRegistryHierarchyRead (req, res, next) {
+ try {
+ if (!req.ctx.authenticated || !req.ctx.orgUUID) {
+ return res.status(403).json(error.secretariatOnly())
+ }
+ const repo = req.ctx.repositories.getBaseOrgRepository()
+ const options = { readPreference: 'primary' }
+ const isSecretariat = await authContext.isRequesterSecretariat(req, repo, options)
+ if (!isSecretariat) {
+ const requesterOrg = await authContext.getRequesterOrg(req, repo, options)
+ if (!authContext.orgHasRole(requesterOrg, 'ROOT')) {
+ return res.status(403).json(error.secretariatOnly())
+ }
+ }
+ req.ctx.registryRead = {
+ isSecretariat,
+ reason: isSecretariat ? 'SECRETARIAT' : 'ROOT',
+ hierarchyScope: isSecretariat ? undefined : req.ctx.orgUUID
+ }
+ next()
+ } catch (err) {
+ next(err)
+ }
+}
+
// Checks that the requester belongs to an org that has the 'SECRETARIAT' role or is a user with the 'ADMIN' role
async function onlySecretariatOrAdmin (req, res, next) {
const org = req.ctx.org
@@ -558,6 +620,8 @@ module.exports = {
validateUser,
useRegistry,
onlySecretariat,
+ authorizeRegistryOrgRead,
+ authorizeRegistryHierarchyRead,
onlySecretariatOrBulkDownload,
onlySecretariatOrAdmin,
onlyCnas,
diff --git a/src/repositories/baseOrgRepository.js b/src/repositories/baseOrgRepository.js
index 8e21786d0..81a28110e 100644
--- a/src/repositories/baseOrgRepository.js
+++ b/src/repositories/baseOrgRepository.js
@@ -525,7 +525,7 @@ class BaseOrgRepository extends BaseRepository {
/**
* Finds organizations by UUID with the fields needed to associate users
- * and organization short names in read response mappings.
+ * and organization short names and administrator roles in read response mappings.
*
* @param {string[]} orgUUIDs - Organization UUIDs to retrieve.
* @param {object} [options={}] - Optional settings for the repository query.
@@ -538,7 +538,7 @@ class BaseOrgRepository extends BaseRepository {
return await BaseOrgModel.find(
{ UUID: { $in: orgUUIDs } },
- { _id: 0, UUID: 1, short_name: 1, users: 1 },
+ { _id: 0, UUID: 1, short_name: 1, users: 1, admins: 1 },
options
)
}
@@ -796,17 +796,20 @@ class BaseOrgRepository extends BaseRepository {
/**
* @async
* @function getAllOrgs
- * @description Retrieves all organizations with pagination.
+ * @description Retrieves organizations with pagination, optionally scoped to authorized UUIDs.
* @param {object} [options={}] - Pagination and query options.
* @param {boolean} [returnLegacyFormat=false] - If true, returns data in legacy format.
+ * @param {boolean} [isSecretariat=false] - Whether restricted registry fields may be returned.
+ * @param {string[]} [orgUUIDs] - Authorized registry organization UUIDs; an empty array matches nothing.
* @returns {Promise