@@ -15,18 +15,13 @@ import {
1515 EntraInvitationError ,
1616 InternalServerError ,
1717 NotFoundError ,
18- ValidationError ,
1918} from "../../common/errors/index.js" ;
2019import {
2120 DynamoDBClient ,
2221 GetItemCommand ,
2322 PutItemCommand ,
2423} from "@aws-sdk/client-dynamodb" ;
25- import {
26- execCouncilGroupId ,
27- execCouncilTestingGroupId ,
28- genericConfig ,
29- } from "../../common/config.js" ;
24+ import { genericConfig } from "../../common/config.js" ;
3025import { marshall , unmarshall } from "@aws-sdk/util-dynamodb" ;
3126import {
3227 InviteUserPostRequest ,
@@ -143,6 +138,10 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
143138 } ) ;
144139 }
145140 reply . send ( { message : "OK" } ) ;
141+ request . log . info (
142+ { type : "audit" , actor : request . username , target : groupId } ,
143+ `set group ID roles to ${ request . body . roles . toString ( ) } ` ,
144+ ) ;
146145 } ,
147146 ) ;
148147 fastify . post < { Body : InviteUserPostRequest } > (
@@ -178,13 +177,26 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
178177 for ( let i = 0 ; i < results . length ; i ++ ) {
179178 const result = results [ i ] ;
180179 if ( result . status === "fulfilled" ) {
180+ request . log . info (
181+ { type : "audit" , actor : request . username , target : emails [ i ] } ,
182+ "invited user to Entra ID tenant." ,
183+ ) ;
181184 response . success . push ( { email : emails [ i ] } ) ;
182185 } else {
186+ request . log . info (
187+ { type : "audit" , actor : request . username , target : emails [ i ] } ,
188+ "failed to invite user to Entra ID tenant." ,
189+ ) ;
183190 if ( result . reason instanceof EntraInvitationError ) {
184191 response . failure . push ( {
185192 email : emails [ i ] ,
186193 message : result . reason . message ,
187194 } ) ;
195+ } else {
196+ response . failure . push ( {
197+ email : emails [ i ] ,
198+ message : "An unknown error occurred." ,
199+ } ) ;
188200 }
189201 }
190202 }
@@ -254,7 +266,23 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
254266 const result = addResults [ i ] ;
255267 if ( result . status === "fulfilled" ) {
256268 response . success . push ( { email : request . body . add [ i ] } ) ;
269+ request . log . info (
270+ {
271+ type : "audit" ,
272+ actor : request . username ,
273+ target : request . body . add [ i ] ,
274+ } ,
275+ `added target to group ID ${ groupId } ` ,
276+ ) ;
257277 } else {
278+ request . log . info (
279+ {
280+ type : "audit" ,
281+ actor : request . username ,
282+ target : request . body . add [ i ] ,
283+ } ,
284+ `failed to add added target to group ID ${ groupId } ` ,
285+ ) ;
258286 if ( result . reason instanceof EntraGroupError ) {
259287 response . failure . push ( {
260288 email : request . body . add [ i ] ,
0 commit comments