@@ -3,8 +3,6 @@ const mongoose = require('mongoose')
33const logger = require ( '../../middleware/logger' )
44const getConstants = require ( '../../constants' ) . getConstants
55const errors = require ( './error' )
6- const { options } = require ( '../cve.controller' )
7- const c = require ( 'config' )
86const error = new errors . OrgControllerError ( )
97const validateUUID = require ( 'uuid' ) . validate
108
@@ -443,10 +441,7 @@ async function createUser (req, res, next) {
443441 try {
444442 const body = req . ctx . body
445443 const userRepo = req . ctx . repositories . getBaseUserRepository ( )
446- const orgRepo = req . ctx . repositories . getBaseOrgRepository ( )
447444 const orgShortName = req . ctx . params . shortname
448- const requesterShortName = req . ctx . org
449- const requesterUsername = req . ctx . user
450445 let returnValue
451446
452447 // Do not allow the user to pass in a UUID
@@ -475,9 +470,6 @@ async function createUser (req, res, next) {
475470 return res . status ( 400 ) . json ( error . userExists ( body ?. username ) )
476471 }
477472
478- const isRequesterSecretariat = await orgRepo . isSecretariatByShortName ( requesterShortName , { session } )
479- const isAdmin = await userRepo . isAdmin ( requesterUsername , requesterShortName , { session } )
480-
481473 if ( ! await userRepo . isAdminOrSecretariat ( orgShortName , req . ctx . user , req . ctx . org , { session } , ! req . useRegistry ) ) {
482474 await session . abortTransaction ( )
483475 return res . status ( 403 ) . json ( error . notOrgAdminOrSecretariat ( ) ) // The Admin user must belong to the new user's organization
@@ -757,48 +749,6 @@ async function resetSecret (req, res, next) {
757749 }
758750}
759751
760- function setAggregateUserObj ( query ) {
761- return [
762- {
763- $match : query
764- } ,
765- {
766- $project : {
767- _id : false ,
768- username : true ,
769- name : true ,
770- UUID : true ,
771- org_UUID : true ,
772- active : true ,
773- 'authority.active_roles' : true ,
774- time : true
775- }
776- }
777- ]
778- }
779- function setAggregateRegistryUserObj ( query ) {
780- return [
781- {
782- $match : query
783- } ,
784- {
785- $project : {
786- _id : false ,
787- UUID : true ,
788- user_id : true ,
789- name : true ,
790- org_affiliations : true ,
791- cve_program_org_membership : true ,
792- created : true ,
793- created_by : true ,
794- last_updated : true ,
795- deactivation_date : true ,
796- last_active : true
797- }
798- }
799- ]
800- }
801-
802752module . exports = {
803753 ORG_ALL : getOrgs ,
804754 ORG_SINGLE : getOrg ,
0 commit comments