@@ -2,14 +2,15 @@ import { NextFunction, Request, Response } from 'express';
22import { z } from 'zod' ;
33
44import { User , UserJobFunction } from '../entities/User' ;
5+ import { isUid2Engineer } from '../helpers/internalEmailHelpers' ;
56import { getLoggers , getTraceId , TraceId } from '../helpers/loggingHelpers' ;
67import { getAllParticipants , UserParticipantRequest } from '../services/participantsService' ;
78import { findUserByEmail , UserRequest } from '../services/usersService' ;
8- import { isSuperUser , isUid2InternalEmail , isUid2Support } from './userRoleMiddleware' ;
9+ import { isSuperUser , isUid2Support } from './userRoleMiddleware' ;
910
1011type UserWithSupportRoles = User & { isUid2Support : boolean ; isSuperUser : boolean } ;
1112
12- const createUid2InternalUser = async (
13+ const createUid2EngineerUser = async (
1314 email : string ,
1415 firstName : string ,
1516 lastName : string
@@ -19,7 +20,7 @@ const createUid2InternalUser = async (
1920 firstName,
2021 lastName,
2122 jobFunction : UserJobFunction . Engineering ,
22- acceptedTerms : true ,
23+ acceptedTerms : false ,
2324 } ) ;
2425} ;
2526
@@ -61,10 +62,10 @@ export const enrichCurrentUser = async (req: UserRequest, res: Response, next: N
6162 const userEmail = req . auth ?. payload ?. email as string ;
6263 let user = await findUserByEmail ( userEmail ) ;
6364
64- if ( ! user && isUid2InternalEmail ( userEmail ) ) {
65+ if ( ! user && isUid2Engineer ( userEmail ) ) {
6566 const firstName = req . auth ?. payload ?. given_name as string ;
6667 const lastName = req . auth ?. payload ?. family_name as string ;
67- await createUid2InternalUser ( userEmail , firstName , lastName ) ;
68+ await createUid2EngineerUser ( userEmail , firstName , lastName ) ;
6869 user = await findUserByEmail ( userEmail ) ;
6970 }
7071
0 commit comments