Skip to content

Commit 04cbb7e

Browse files
authored
Merge pull request #1522 from CVEProject/dr_1483_id_quota_documentation
Closes #1483 - id_quota documentation
2 parents baaf395 + 74c4c25 commit 04cbb7e

File tree

2 files changed

+140
-4
lines changed

2 files changed

+140
-4
lines changed

api-docs/openapi.json

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,23 +2012,92 @@
20122012
},
20132013
"/registry/org/{shortname}/id_quota": {
20142014
"get": {
2015-
"description": "",
2015+
"tags": [
2016+
"Registry Organization"
2017+
],
2018+
"summary": "Retrieves an organization's CVE ID quota (accessible to all registered users)",
2019+
"description": " <h2>Access Control</h2> <p>All registered users can access this endpoint</p> <h2>Expected Behavior</h2> <p><b>Regular, CNA & Admin Users:</b> Retrieves the CVE ID quota for the user's organization</p> <p><b>Secretariat:</b> Retrieves the CVE ID quota for any organization</p>",
2020+
"operationId": "orgIdQuota",
20162021
"parameters": [
20172022
{
20182023
"name": "shortname",
20192024
"in": "path",
20202025
"required": true,
20212026
"schema": {
20222027
"type": "string"
2023-
}
2028+
},
2029+
"description": "The shortname of the organization"
2030+
},
2031+
{
2032+
"$ref": "#/components/parameters/apiEntityHeader"
2033+
},
2034+
{
2035+
"$ref": "#/components/parameters/apiUserHeader"
2036+
},
2037+
{
2038+
"$ref": "#/components/parameters/apiSecretHeader"
20242039
}
20252040
],
20262041
"responses": {
2042+
"200": {
2043+
"description": "Returns the CVE ID quota for an organization",
2044+
"content": {
2045+
"application/json": {
2046+
"schema": {
2047+
"$ref": "../schemas/registry-org/get-registry-org-quota-response.json"
2048+
}
2049+
}
2050+
}
2051+
},
20272052
"400": {
2028-
"description": "Bad Request"
2053+
"description": "Bad Request",
2054+
"content": {
2055+
"application/json": {
2056+
"schema": {
2057+
"$ref": "../schemas/errors/bad-request.json"
2058+
}
2059+
}
2060+
}
20292061
},
20302062
"401": {
2031-
"description": "Unauthorized"
2063+
"description": "Not Authenticated",
2064+
"content": {
2065+
"application/json": {
2066+
"schema": {
2067+
"$ref": "../schemas/errors/generic.json"
2068+
}
2069+
}
2070+
}
2071+
},
2072+
"403": {
2073+
"description": "Forbidden",
2074+
"content": {
2075+
"application/json": {
2076+
"schema": {
2077+
"$ref": "../schemas/errors/generic.json"
2078+
}
2079+
}
2080+
}
2081+
},
2082+
"404": {
2083+
"description": "Not Found",
2084+
"content": {
2085+
"application/json": {
2086+
"schema": {
2087+
"$ref": "../schemas/errors/generic.json"
2088+
}
2089+
}
2090+
}
2091+
},
2092+
"500": {
2093+
"description": "Internal Server Error",
2094+
"content": {
2095+
"application/json": {
2096+
"schema": {
2097+
"$ref": "../schemas/errors/generic.json"
2098+
}
2099+
}
2100+
}
20322101
}
20332102
}
20342103
}

src/controller/org.controller/index.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,73 @@ router.get('/registry/org/:shortname/users',
9999
controller.USER_ALL)
100100

101101
router.get('/registry/org/:shortname/id_quota',
102+
/*
103+
#swagger.tags = ['Registry Organization']
104+
#swagger.operationId = 'orgIdQuota'
105+
#swagger.summary = "Retrieves an organization's CVE ID quota (accessible to all registered users)"
106+
#swagger.description = "
107+
<h2>Access Control</h2>
108+
<p>All registered users can access this endpoint</p>
109+
<h2>Expected Behavior</h2>
110+
<p><b>Regular, CNA & Admin Users:</b> Retrieves the CVE ID quota for the user's organization</p>
111+
<p><b>Secretariat:</b> Retrieves the CVE ID quota for any organization</p>"
112+
#swagger.parameters['shortname'] = { description: 'The shortname of the organization' }
113+
#swagger.parameters['$ref'] = [
114+
'#/components/parameters/apiEntityHeader',
115+
'#/components/parameters/apiUserHeader',
116+
'#/components/parameters/apiSecretHeader'
117+
]
118+
#swagger.responses[200] = {
119+
description: 'Returns the CVE ID quota for an organization',
120+
content: {
121+
"application/json": {
122+
schema: {
123+
$ref: '../schemas/registry-org/get-registry-org-quota-response.json'
124+
}
125+
}
126+
}
127+
}
128+
#swagger.responses[400] = {
129+
description: 'Bad Request',
130+
content: {
131+
"application/json": {
132+
schema: { $ref: '../schemas/errors/bad-request.json' }
133+
}
134+
}
135+
}
136+
#swagger.responses[401] = {
137+
description: 'Not Authenticated',
138+
content: {
139+
"application/json": {
140+
schema: { $ref: '../schemas/errors/generic.json' }
141+
}
142+
}
143+
}
144+
#swagger.responses[403] = {
145+
description: 'Forbidden',
146+
content: {
147+
"application/json": {
148+
schema: { $ref: '../schemas/errors/generic.json' }
149+
}
150+
}
151+
}
152+
#swagger.responses[404] = {
153+
description: 'Not Found',
154+
content: {
155+
"application/json": {
156+
schema: { $ref: '../schemas/errors/generic.json' }
157+
}
158+
}
159+
}
160+
#swagger.responses[500] = {
161+
description: 'Internal Server Error',
162+
content: {
163+
"application/json": {
164+
schema: { $ref: '../schemas/errors/generic.json' }
165+
}
166+
}
167+
}
168+
*/
102169
mw.useRegistry(),
103170
mw.validateUser,
104171
param(['shortname']).isString().trim().notEmpty().isLength({ min: CONSTANTS.MIN_SHORTNAME_LENGTH, max: CONSTANTS.MAX_SHORTNAME_LENGTH }),

0 commit comments

Comments
 (0)