@@ -122,7 +122,7 @@ async function getUsers (req, res, next) {
122122 return res . status ( 403 ) . json ( error . notSameOrgOrSecretariat ( ) )
123123 }
124124
125- const payload = await userRepo . getAllUsersByOrgShortname ( orgShortName , options , ! req . useRegistry )
125+ const payload = await userRepo . getAllUsersByOrgShortname ( orgShortName , options , ! ! req . useRegistry )
126126
127127 logger . info ( { uuid : req . ctx . uuid , message : `The users of ${ orgShortName } organization were sent to the user.` } )
128128 return res . status ( 200 ) . json ( payload )
@@ -157,7 +157,7 @@ async function getUser (req, res, next) {
157157
158158 const userRepo = req . ctx . repositories . getBaseUserRepository ( )
159159 // This is simple, we can just call our function
160- const result = await userRepo . findOneByUsernameAndOrgShortname ( username , orgShortName , { } , ! req . useRegistry )
160+ const result = await userRepo . findOneByUsernameAndOrgShortname ( username , orgShortName , { } , ! ! req . useRegistry )
161161
162162 if ( ! result ) {
163163 logger . info ( { uuid : req . ctx . uuid , message : username + ' does not exist.' } )
@@ -249,7 +249,6 @@ async function createOrg (req, res, next) {
249249 }
250250
251251 // Check to see if the org already exits
252- // Org exists funciton checks if we should "return the legacy format" NOT "IS IT" a legacy format. TODO: Fix that.
253252 if ( await repo . orgExists ( body ?. short_name , { session } , ! req . useRegistry ) ) {
254253 logger . info ( { uuid : req . ctx . uuid , message : body ?. short_name + ' organization was not created because it already exists.' } )
255254 await session . abortTransaction ( )
@@ -413,13 +412,13 @@ async function createUser (req, res, next) {
413412 }
414413
415414 // Ask repo if user already exists
416- if ( await userRepo . orgHasUser ( orgShortName , body ?. username , { session } , ! req . useRegistry ) ) {
415+ if ( await userRepo . orgHasUser ( orgShortName , body ?. username , { session } , ! ! req . useRegistry ) ) {
417416 logger . info ( { uuid : req . ctx . uuid , message : `${ body ?. username } user was not created because it already exists.` } )
418417 await session . abortTransaction ( )
419418 return res . status ( 400 ) . json ( error . userExists ( body ?. username ) )
420419 }
421420
422- if ( ! await userRepo . isAdminOrSecretariat ( orgShortName , req . ctx . user , req . ctx . org , { session } , ! req . useRegistry ) ) {
421+ if ( ! await userRepo . isAdminOrSecretariat ( orgShortName , req . ctx . user , req . ctx . org , { session } , ! ! req . useRegistry ) ) {
423422 await session . abortTransaction ( )
424423 return res . status ( 403 ) . json ( error . notOrgAdminOrSecretariat ( ) ) // The Admin user must belong to the new user's organization
425424 }
@@ -430,7 +429,7 @@ async function createUser (req, res, next) {
430429 return res . status ( 400 ) . json ( error . userLimitReached ( ) )
431430 }
432431
433- returnValue = await userRepo . createUser ( orgShortName , body , { session, upsert : true } , ! req . useRegistry )
432+ returnValue = await userRepo . createUser ( orgShortName , body , { session, upsert : true } , ! ! req . useRegistry )
434433 await session . commitTransaction ( )
435434 } catch ( error ) {
436435 await session . abortTransaction ( )
@@ -482,8 +481,8 @@ async function updateUser (req, res, next) {
482481 const queryParametersJson = req . ctx . query
483482
484483 // Get requester UUID for later
485- const requesterUUID = await userRepo . getUserUUID ( requesterUsername , requesterShortName , { session } , ! req . useRegistry )
486- const targetUserUUID = await userRepo . getUserUUID ( usernameParams , shortNameParams , { session } , ! req . useRegistry )
484+ const requesterUUID = await userRepo . getUserUUID ( requesterUsername , requesterShortName , { session } , ! ! req . useRegistry )
485+ const targetUserUUID = await userRepo . getUserUUID ( usernameParams , shortNameParams , { session } , ! ! req . useRegistry )
487486
488487 const isRequesterSecretariat = await orgRepo . isSecretariatByShortName ( requesterShortName , { session } )
489488 const isAdmin = await userRepo . isAdmin ( requesterUsername , requesterShortName , { session } )
@@ -600,7 +599,7 @@ async function updateUser (req, res, next) {
600599 }
601600 }
602601
603- const payload = await userRepo . updateUser ( usernameParams , shortNameParams , queryParametersJson , { session } , ! req . useRegistry )
602+ const payload = await userRepo . updateUser ( usernameParams , shortNameParams , queryParametersJson , { session } , ! ! req . useRegistry )
604603 await session . commitTransaction ( )
605604 return res . status ( 200 ) . json ( { message : `${ usernameParams } was successfully updated.` , updated : payload } )
606605 } catch ( err ) {
@@ -646,14 +645,14 @@ async function resetSecret (req, res, next) {
646645 }
647646
648647 // Check if target user exists in target org
649- const targetUserUUID = await userRepo . getUserUUID ( targetUsername , targetOrgShortName , { session } , ! req . useRegistry )
648+ const targetUserUUID = await userRepo . getUserUUID ( targetUsername , targetOrgShortName , { session } , ! ! req . useRegistry )
650649 if ( ! targetUserUUID ) {
651650 logger . info ( { uuid : req . ctx . uuid , message : 'User DNE' } )
652651 await session . abortTransaction ( )
653652 return res . status ( 404 ) . json ( error . userDne ( targetUsername ) )
654653 }
655654
656- const requesterUserUUID = await userRepo . getUserUUID ( requesterUsername , requesterOrgShortName , { session } , ! req . useRegistry )
655+ const requesterUserUUID = await userRepo . getUserUUID ( requesterUsername , requesterOrgShortName , { session } , ! ! req . useRegistry )
657656
658657 const isRequesterSecretariat = await orgRepo . isSecretariatByShortName ( requesterOrgShortName , { session } )
659658
@@ -679,7 +678,7 @@ async function resetSecret (req, res, next) {
679678 }
680679 }
681680
682- const updatedSecret = await userRepo . resetSecret ( targetUsername , targetOrgShortName , { session } , ! req . useRegistry )
681+ const updatedSecret = await userRepo . resetSecret ( targetUsername , targetOrgShortName , { session } , ! ! req . useRegistry )
683682
684683 logger . info ( { uuid : req . ctx . uuid , message : `The API secret was successfully reset and sent to ${ targetUsername } ` } )
685684 const payload = {
0 commit comments