Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions api-docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4267,6 +4267,218 @@
}
}
},
"/registry/org/{shortname}/oversees/{shortname2}/add": {
"post": {
"tags": [
"Registry Organization"
],
"summary": "Assigns an organization to report to a ROOT organization (accessible to Secretariat only)",
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role.</p> <h2>Expected Behavior</h2> <p>The organization identified by <b>shortname</b> must have <b>ROOT</b> authority. The organization identified by <b>shortname2</b> will report to it. If <b>shortname2</b> already reported to a different <b>ROOT</b>. It will be removed from that and both will receive an audit entry.</p>",
"operationId": "registryOrgAddOverseeRelationship",
"parameters": [
{
"name": "shortname",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The shortname of the overseeing ROOT organization"
},
{
"name": "shortname2",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The shortname of the reporting organization"
},
{
"$ref": "#/components/parameters/apiEntityHeader"
},
{
"$ref": "#/components/parameters/apiUserHeader"
},
{
"$ref": "#/components/parameters/apiSecretHeader"
}
],
"responses": {
"200": {
"description": "Reports-to relationship added successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/bad-request.json"
}
}
}
},
"401": {
"description": "Not Authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
}
}
}
},
"/registry/org/{shortname}/oversees/{shortname2}/remove": {
"post": {
"tags": [
"Registry Organization"
],
"summary": "Removes an organization reports-to relationship (accessible to Secretariat only)",
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role.</p> <h2>Expected Behavior</h2> <p>The organization identified by <b>shortname</b> must have <b>ROOT</b> authority. The organization identified by <b>shortname2</b> will no longer report to it.</p>",
"operationId": "registryOrgRemoveOverseeRelationship",
"parameters": [
{
"name": "shortname",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The shortname of the overseeing ROOT organization"
},
{
"name": "shortname2",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The shortname of the reporting organization"
},
{
"$ref": "#/components/parameters/apiEntityHeader"
},
{
"$ref": "#/components/parameters/apiUserHeader"
},
{
"$ref": "#/components/parameters/apiSecretHeader"
}
],
"responses": {
"200": {
"description": "Reports-to relationship removed successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/bad-request.json"
}
}
}
},
"401": {
"description": "Not Authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/errors/generic.json"
}
}
}
}
}
}
},
"/registry/org/{shortname}/user/{username}/grant-role": {
"post": {
"tags": [
Expand Down
71 changes: 71 additions & 0 deletions src/controller/registry.controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,77 @@
controller.USER_RESET_SECRET
)

router.post('/registry/org/:shortname/oversees/:shortname2/add',
/*
#swagger.tags = ['Registry Organization']
#swagger.operationId = 'registryOrgAddOverseeRelationship'
#swagger.summary = 'Assigns an organization to report to a ROOT organization (accessible to Secretariat only)'
#swagger.description = '
<h2>Access Control</h2>
<p>User must belong to an organization with the <b>Secretariat</b> role.</p>
<h2>Expected Behavior</h2>
<p>The organization identified by <b>shortname</b> must have <b>ROOT</b> authority. The organization identified by <b>shortname2</b> will
report to it. If <b>shortname2</b> already reported to a different <b>ROOT</b>. It will be removed from that and both will receive an audit entry.</p>'
#swagger.parameters['shortname'] = { description: 'The shortname of the overseeing ROOT organization' }
#swagger.parameters['shortname2'] = { description: 'The shortname of the reporting organization' }
#swagger.parameters['$ref'] = [
'#/components/parameters/apiEntityHeader',
'#/components/parameters/apiUserHeader',
'#/components/parameters/apiSecretHeader'
]
#swagger.responses[200] = {
description: 'Reports-to relationship added successfully',
content: { 'application/json': { schema: { type: 'object', properties: { message: { type: 'string' } } } } }
}
#swagger.responses[400] = { description: 'Bad Request', content: { 'application/json': { schema: { $ref: '../schemas/errors/bad-request.json' } } } }
#swagger.responses[401] = { description: 'Not Authenticated', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[403] = { description: 'Forbidden', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[404] = { description: 'Not Found', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[500] = { description: 'Internal Server Error', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
*/
mw.useRegistry(),
mw.validateUser,
Comment thread
jdaigneau5 marked this conversation as resolved.
Dismissed
mw.onlySecretariat,
parseError,
parsePostParams,
registryOrgController.ADD_OVERSEE_RELATIONSHIP
)

router.post('/registry/org/:shortname/oversees/:shortname2/remove',
/*
#swagger.tags = ['Registry Organization']
#swagger.operationId = 'registryOrgRemoveOverseeRelationship'
#swagger.summary = 'Removes an organization reports-to relationship (accessible to Secretariat only)'
#swagger.description = '
<h2>Access Control</h2>
<p>User must belong to an organization with the <b>Secretariat</b> role.</p>
<h2>Expected Behavior</h2>
<p>The organization identified by <b>shortname</b> must have <b>ROOT</b> authority. The organization identified by <b>shortname2</b> will no longer report to it.</p>'
#swagger.parameters['shortname'] = { description: 'The shortname of the overseeing ROOT organization' }
#swagger.parameters['shortname2'] = { description: 'The shortname of the reporting organization' }
#swagger.parameters['$ref'] = [
'#/components/parameters/apiEntityHeader',
'#/components/parameters/apiUserHeader',
'#/components/parameters/apiSecretHeader'
]
#swagger.responses[200] = {
description: 'Reports-to relationship removed successfully',
content: { 'application/json': { schema: { type: 'object', properties: { message: { type: 'string' } } } } }
}
#swagger.responses[400] = { description: 'Bad Request', content: { 'application/json': { schema: { $ref: '../schemas/errors/bad-request.json' } } } }
#swagger.responses[401] = { description: 'Not Authenticated', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[403] = { description: 'Forbidden', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[404] = { description: 'Not Found', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
#swagger.responses[500] = { description: 'Internal Server Error', content: { 'application/json': { schema: { $ref: '../schemas/errors/generic.json' } } } }
*/
mw.useRegistry(),
mw.validateUser,
Comment thread
jdaigneau5 marked this conversation as resolved.
Dismissed
mw.onlySecretariat,
parseError,
parsePostParams,
registryOrgController.REMOVE_OVERSEE_RELATIONSHIP
)

router.post('/registry/org/:shortname/user/:username/grant-role',
/*
#swagger.tags = ['Registry User']
Expand Down
7 changes: 7 additions & 0 deletions src/controller/registry.controller/org.error.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ class RegistryOrgControllerError extends idrErr.IDRError {
err.message = `The following fields can only be modified by the Secretariat: ${fields.join(', ')}.`
return err
}

overseeingOrgMustBeRoot (shortname) {
const err = {}
err.error = 'OVERSEEING_ORG_MUST_BE_ROOT'
err.message = `The '${shortname}' organization must have ROOT authority to oversee another organization.`
return err
}
}

module.exports = {
Expand Down
Loading
Loading