@@ -20,6 +20,7 @@ import { v4 as uuidv4 } from 'uuid';
2020
2121import { i18n } from '../../../../server/lib/i18n' ;
2222import { SystemLogger } from '../../../../server/lib/logger/system' ;
23+ import { resetAuditedSettingByUser , updateAuditedByUser } from '../../../../server/settings/lib/auditedSettingUpdates' ;
2324import { getLogs } from '../../../../server/stream/stdout' ;
2425import { passwordPolicy } from '../../../lib/server' ;
2526import { notifyOnSettingChangedById } from '../../../lib/server/lib/notifyListener' ;
@@ -683,20 +684,32 @@ API.v1.addRoute(
683684
684685 settingsIds . push ( 'Deployment_FingerPrint_Verified' ) ;
685686
687+ const auditSettingOperation = updateAuditedByUser ( {
688+ _id : this . userId ,
689+ username : this . user . username ! ,
690+ ip : this . requestIp ,
691+ useragent : this . request . headers [ 'user-agent' ] || '' ,
692+ } ) ;
693+
686694 const promises = settingsIds . map ( ( settingId ) => {
687695 if ( settingId === 'uniqueID' ) {
688- return Settings . resetValueById ( 'uniqueID' , process . env . DEPLOYMENT_ID || uuidv4 ( ) ) ;
696+ return auditSettingOperation ( Settings . resetValueById , 'uniqueID' , process . env . DEPLOYMENT_ID || uuidv4 ( ) ) ;
689697 }
690698
691699 if ( settingId === 'Cloud_Workspace_Access_Token_Expires_At' ) {
692- return Settings . resetValueById ( 'Cloud_Workspace_Access_Token_Expires_At' , new Date ( 0 ) ) ;
700+ return auditSettingOperation ( Settings . resetValueById , 'Cloud_Workspace_Access_Token_Expires_At' , new Date ( 0 ) ) ;
693701 }
694702
695703 if ( settingId === 'Deployment_FingerPrint_Verified' ) {
696- return Settings . updateValueById ( 'Deployment_FingerPrint_Verified' , true ) ;
704+ return auditSettingOperation ( Settings . updateValueById , 'Deployment_FingerPrint_Verified' , true ) ;
697705 }
698706
699- return Settings . resetValueById ( settingId ) ;
707+ return resetAuditedSettingByUser ( {
708+ _id : this . userId ,
709+ username : this . user . username ! ,
710+ ip : this . requestIp ,
711+ useragent : this . request . headers [ 'user-agent' ] || '' ,
712+ } ) ( Settings . resetValueById , settingId ) ;
700713 } ) ;
701714
702715 ( await Promise . all ( promises ) ) . forEach ( ( value , index ) => {
0 commit comments