Skip to content

Commit edcdd5b

Browse files
committed
Remove unsupported registry user membership fields
1 parent ab82ed7 commit edcdd5b

11 files changed

Lines changed: 7 additions & 203 deletions

schemas/registry-user/BaseUser.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,6 @@
8787
"inactive"
8888
]
8989
},
90-
"org_affiliations": {
91-
"description": "UUIDs of organizations the user is affiliated with",
92-
"type": "array",
93-
"items": {
94-
"$ref": "#/definitions/uuidType"
95-
}
96-
},
97-
"cve_program_org_membership": {
98-
"description": "UUIDs of CVE program organizations the user is a member of",
99-
"type": "array",
100-
"items": {
101-
"$ref": "#/definitions/uuidType"
102-
}
103-
},
10490
"role": {
10591
"description": "The user's role in the organization",
10692
"type": "string"

schemas/registry-user/create-registry-user-request.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,6 @@
3131
},
3232
"required": ["first", "last"]
3333
},
34-
"org_affiliations": {
35-
"type": "array",
36-
"items": {
37-
"type": "string"
38-
},
39-
"description": "UUIDs of organizations the user is affiliated with"
40-
},
41-
"cve_program_org_membership": {
42-
"type": "array",
43-
"items": {
44-
"type": "string"
45-
},
46-
"description": "UUIDs of CVE program organizations the user is a member of"
47-
},
4834
"authority": {
4935
"type": "object",
5036
"properties": {

schemas/registry-user/create-registry-user-response.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@
4242
},
4343
"required": ["first", "last"]
4444
},
45-
"org_affiliations": {
46-
"type": "array",
47-
"items": {
48-
"type": "string"
49-
},
50-
"description": "UUIDs of organizations the user is affiliated with"
51-
},
52-
"cve_program_org_membership": {
53-
"type": "array",
54-
"items": {
55-
"type": "string"
56-
},
57-
"description": "UUIDs of CVE program organizations the user is a member of"
58-
},
5945
"authority": {
6046
"type": "object",
6147
"properties": {
@@ -115,4 +101,4 @@
115101
}
116102
}
117103
}
118-
}
104+
}

schemas/registry-user/get-registry-user-response.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@
4343
"enum": ["ADMIN"],
4444
"description": "The role of the user in the organization. Currently only 'ADMIN' is supported."
4545
},
46-
"org_affiliations": {
47-
"type": "array",
48-
"items": {
49-
"type": "string"
50-
},
51-
"description": "UUIDs of organizations the user is affiliated with"
52-
},
53-
"cve_program_org_membership": {
54-
"type": "array",
55-
"items": {
56-
"type": "string"
57-
},
58-
"description": "UUIDs of CVE program organizations the user is a member of"
59-
},
6046
"authority": {
6147
"type": "object",
6248
"properties": {
@@ -127,4 +113,4 @@
127113
"description": "Timestamp of the last update to the user data"
128114
}
129115
}
130-
}
116+
}

schemas/registry-user/update-registry-user-request.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@
3030
}
3131
}
3232
},
33-
"org_affiliations": {
34-
"type": "array",
35-
"items": {
36-
"type": "string"
37-
},
38-
"description": "UUIDs of organizations the user is affiliated with"
39-
},
40-
"cve_program_org_membership": {
41-
"type": "array",
42-
"items": {
43-
"type": "string"
44-
},
45-
"description": "UUIDs of CVE program organizations the user is a member of"
46-
},
4733
"authority": {
4834
"type": "object",
4935
"properties": {

schemas/registry-user/update-registry-user-response.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@
4242
},
4343
"required": ["first", "last"]
4444
},
45-
"org_affiliations": {
46-
"type": "array",
47-
"items": {
48-
"type": "string"
49-
},
50-
"description": "UUIDs of organizations the user is affiliated with"
51-
},
52-
"cve_program_org_membership": {
53-
"type": "array",
54-
"items": {
55-
"type": "string"
56-
},
57-
"description": "UUIDs of CVE program organizations the user is a member of"
58-
},
5945
"authority": {
6046
"type": "object",
6147
"properties": {
@@ -115,4 +101,4 @@
115101
}
116102
}
117103
}
118-
}
104+
}

src/controller/registry-user.controller/registry-user.middleware.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ function parsePostParams (req, res, next) {
88
utils.reqCtxMapping(req, 'params', ['identifier', 'shortname'])
99
utils.reqCtxMapping(req, 'query', [
1010
'new_username',
11-
'name.first', 'name.last', 'name.middle', 'name.suffix',
12-
'org_affiliations.add', 'org_affiliations.remove',
13-
'cve_program_org_membership.add', 'cve_program_org_membership.remove'
11+
'name.first', 'name.last', 'name.middle', 'name.suffix'
1412
])
1513
next()
1614
}

src/model/baseuser.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ const schema = {
2626
last: String,
2727
suffix: String
2828
},
29-
status: { type: String, enum: ['active', 'inactive'] },
30-
org_affiliations: [String],
31-
cve_program_org_membership: [String]
29+
status: { type: String, enum: ['active', 'inactive'] }
3230
}
3331

3432
// Export BaseUser model

test/integration-tests/user/updateUserTest.js

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -213,54 +213,6 @@ describe('Testing Edit user endpoint', () => {
213213
expect(res.body.updated.status).to.equal('active')
214214
})
215215
})
216-
it('Should update org affiliations with registry enabled', async () => {
217-
const user = await createRegistryUserForUpdateTest('range_4')
218-
let affiliatedOrg
219-
await chai.request(app)
220-
.get('/api/registry/org/win_5')
221-
.set(constants.headers)
222-
.then((res) => {
223-
expect(res).to.have.status(200)
224-
affiliatedOrg = res.body
225-
})
226-
227-
await chai.request(app)
228-
.put(`/api/registry/org/range_4/user/${user.username}`)
229-
.set(constants.headers)
230-
.send({
231-
...user,
232-
org_affiliations: [affiliatedOrg.UUID]
233-
})
234-
.then((res, err) => {
235-
expect(err).to.be.undefined
236-
expect(res).to.have.status(200)
237-
expect(res.body.updated.org_affiliations).to.deep.equal([affiliatedOrg.UUID])
238-
})
239-
})
240-
it('Should update CVE program org membership with registry enabled', async () => {
241-
const user = await createRegistryUserForUpdateTest('range_4')
242-
let memberOrg
243-
await chai.request(app)
244-
.get('/api/registry/org/range_4')
245-
.set(constants.headers)
246-
.then((res) => {
247-
expect(res).to.have.status(200)
248-
memberOrg = res.body
249-
})
250-
251-
await chai.request(app)
252-
.put(`/api/registry/org/range_4/user/${user.username}`)
253-
.set(constants.headers)
254-
.send({
255-
...user,
256-
cve_program_org_membership: [memberOrg.UUID]
257-
})
258-
.then((res, err) => {
259-
expect(err).to.be.undefined
260-
expect(res).to.have.status(200)
261-
expect(res.body.updated.cve_program_org_membership).to.deep.equal([memberOrg.UUID])
262-
})
263-
})
264216
})
265217
context('Negative Tests', () => {
266218
it('Should return an error when admin is required', async () => {
@@ -289,38 +241,6 @@ describe('Testing Edit user endpoint', () => {
289241
expect(res.body.error).to.contain('NOT_ALLOWED_TO_CHANGE_FIELD')
290242
})
291243
})
292-
it('Should return an error when a regular user attempts to update org affiliations with registry enabled', async () => {
293-
let user
294-
await chai.request(app).get('/api/registry/org/win_5/user/jasminesmith@win_5.com').set(constants.nonSecretariatUserHeaders).then((res) => { user = res.body })
295-
await chai.request(app)
296-
.put('/api/registry/org/win_5/user/jasminesmith@win_5.com')
297-
.set(constants.nonSecretariatUserHeaders)
298-
.send({
299-
...user,
300-
org_affiliations: ['d41d8cd9-8f00-3204-a980-0998ecf8427e']
301-
})
302-
.then((res, err) => {
303-
expect(err).to.be.undefined
304-
expect(res).to.have.status(400)
305-
expect(res.body.error).to.contain('NOT_ALLOWED_TO_CHANGE_FIELD')
306-
})
307-
})
308-
it('Should return an error when a regular user attempts to update CVE program org membership with registry enabled', async () => {
309-
let user
310-
await chai.request(app).get('/api/registry/org/win_5/user/jasminesmith@win_5.com').set(constants.nonSecretariatUserHeaders).then((res) => { user = res.body })
311-
await chai.request(app)
312-
.put('/api/registry/org/win_5/user/jasminesmith@win_5.com')
313-
.set(constants.nonSecretariatUserHeaders)
314-
.send({
315-
...user,
316-
cve_program_org_membership: ['7f593536-7cbc-46fd-bdd9-b6176c9cd93f']
317-
})
318-
.then((res, err) => {
319-
expect(err).to.be.undefined
320-
expect(res).to.have.status(400)
321-
expect(res.body.error).to.contain('NOT_ALLOWED_TO_CHANGE_FIELD')
322-
})
323-
})
324244
it('Should not allow a first name of more than 100 characters', async () => {
325245
await chai.request(app)
326246
.put('/api/org/win_5/user/jasminesmith@win_5.com?name.first=1:1234567,2:1234567,3:1234567,4:1234567,5:1234567,6:1234567,7:1234567,8:1234567,9:1234567,10:1234567,11:1234567')

test/unit-tests/user/baseUserModelTest.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)