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
4 changes: 1 addition & 3 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function getConstants () {
USER_ROLES: [
'ADMIN'
],
JOINT_APPROVAL_FIELDS: ['short_name', 'long_name', 'authority', 'aliases', 'oversees', 'top_level_root', 'charter_or_scope', 'product_list', 'disclosure_policy', 'partner_role_type', 'partner_number', 'program_data.cve_website_update_date', 'program_data.cve_website_update_needed', 'program_data.status', 'advisory_locations', 'advisory_location_require_credentials', 'vulnerability_advisory_location_for_web_scraping', 'tl_root_start_date', 'is_cna_discussion_list', 'id_quota'],
JOINT_APPROVAL_FIELDS: ['short_name', 'long_name', 'authority', 'aliases', 'oversees', 'top_level_root', 'is_top_level_root', 'is_last_resort', 'charter_or_scope', 'product_list', 'disclosure_policy', 'partner_role_type', 'partner_number', 'program_data.cve_website_update_date', 'program_data.cve_website_update_needed', 'program_data.status', 'advisory_locations', 'advisory_location_require_credentials', 'vulnerability_advisory_location_for_web_scraping', 'tl_root_start_date', 'is_cna_discussion_list', 'id_quota'],
JOINT_APPROVAL_FIELDS_LEGACY: ['short_name', 'name', 'authority.active_roles', 'policies.id_quota'],
ORG_EXCLUDED_FIELDS: ['__t', '__v', '_id', 'inUse', 'in_use'],
ORG_RESTRICTED_FIELDS: ['program_data'],
Expand All @@ -55,8 +55,6 @@ function getConstants () {
'program_data.cve_website_update_needed',
'program_data.status',
'top_level_root',
'is_top_level_root',
'is_last_resort',
'oversees'
],
USER_ROLE_ENUM: {
Expand Down
2 changes: 2 additions & 0 deletions src/controller/registry.controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ router.put('/registry/org/:shortname',
<li>aliases</li>
<li>oversees</li>
<li>top_level_root</li>
<li>is_top_level_root</li>
<li>is_last_resort</li>
<li>charter_or_scope</li>
<li>product_list</li>
<li>disclosure_policy</li>
Expand Down
16 changes: 13 additions & 3 deletions test/integration-tests/registry-org/rootOrgTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ describe('Testing ROOT Organization Type', () => {
})
})

it('ROOT admin cannot edit is_top_level_root', async () => {
it('ROOT admin can request a change to is_top_level_root through joint approval', async () => {
await chai.request(app)
.put(`/api/registry/org/${testRootOrg.short_name}`)
.set(rootAdminHeaders)
Expand All @@ -283,8 +283,18 @@ describe('Testing ROOT Organization Type', () => {
is_top_level_root: true
})
.then((res) => {
expect(res).to.have.status(403)
expect(res.body.error).to.equal('SECRETARIAT_ONLY')
expect(res).to.have.status(200)
expect(res.body.message).to.include('joint approval is required')
expect(res.body.updated.is_top_level_root).to.equal(false)
})

return chai.request(app)
.get(`/api/review/org/${testRootOrg.short_name}`)
.set(secretariatHeaders)
.then((res) => {
expect(res).to.have.status(200)
expect(res.body.status).to.equal('pending')
expect(res.body).to.have.nested.property('new_review_data.is_top_level_root', true)
})
})

Expand Down
2 changes: 2 additions & 0 deletions test/integration-tests/review-object/reviewObjectTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ describe('Review Object Controller Integration Tests', () => {
updateData.long_name = 'Approve Test Organization'
updateData.authority = ['CNA']
updateData.id_quota = 1000
updateData.is_last_resort = true
updateData.contact_info = { websites: ['https://www.example.com'] }
const res = await chai
.request(app)
Expand All @@ -232,6 +233,7 @@ describe('Review Object Controller Integration Tests', () => {
expect(reviewRes.body).to.have.property('uuid')
expect(reviewRes.body.status).to.equal('pending')
expect(reviewRes.body).to.have.nested.property('new_review_data.long_name', 'Approve Test Organization')
expect(reviewRes.body).to.have.nested.property('new_review_data.is_last_resort', true)
expect(reviewRes.body.new_review_data.contact_info.websites[0]).to.equal('https://www.example.com')
approveTestReviewUUID = reviewRes.body.uuid
})
Expand Down
Loading