From 995e75da8e5e1a48f50ee366d08835c5568d12b7 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 5 Feb 2025 13:29:42 +0100 Subject: [PATCH] fix(audit): add user id who caused company superior change to audit log --- src/Audit/Types.hs | 9 ++++++++- src/Handler/Utils/Avs.hs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Audit/Types.hs b/src/Audit/Types.hs index f20aaed95..25809967d 100644 --- a/src/Audit/Types.hs +++ b/src/Audit/Types.hs @@ -213,6 +213,12 @@ data Transaction , transactionNote :: Maybe Text , transactionReceived :: UTCTime -- when was the csv file received? } + | TransactionLmsTerminated + { transactionQualification :: QualificationId + , transactionLmsIdent :: LmsIdent + , transactionLmsUser :: UserId + , transactionNote :: Maybe Text + } | TransactionQualificationUserEdit -- Note that a renewal always entails unblocking as well! { transactionUser :: UserId -- qualification holder that is updated , transactionQualificationUser :: QualificationUserId -- not really necessary, maybe remove? @@ -283,7 +289,8 @@ data AdminProblem , adminProblemUserOld :: Maybe UserId -- previous superior } | AdminProblemCompanySuperiorNotFound -- a company received a new superior user through AVS, but user could not be created from email - { adminProblemEmail :: Maybe Text -- new superior user's email, not found in LDAP + { adminProblemUser :: UserId -- user who had a supervisor but no longer has, due to supervisor change + , adminProblemEmail :: Maybe Text -- new superior user's email, not found in LDAP , adminProblemCompany :: CompanyId -- affected company , adminProblemUserOld :: Maybe UserId -- previous superior } diff --git a/src/Handler/Utils/Avs.hs b/src/Handler/Utils/Avs.hs index ff4309b32..7d696974d 100644 --- a/src/Handler/Utils/Avs.hs +++ b/src/Handler/Utils/Avs.hs @@ -719,7 +719,7 @@ upsertCompanySuperior Entity{entityKey=cid, entityVal=Company{}} newAfi oldAfi u (Nothing, Nothing) -> when (unchangedCompany && changedSuperior) $ do oldSupId <- getOldId - reportAdminProblem $ AdminProblemCompanySuperiorNotFound mbSupEmail cid oldSupId + reportAdminProblem $ AdminProblemCompanySuperiorNotFound usrId mbSupEmail cid oldSupId -- | queue AVS synch for several UserIds, if a day is given, the last synch must be before the date to trigger an update queueAvsUpdateByUID :: (MonoFoldable mono, UserId ~ Element mono) => mono -> Maybe Day -> DB Int64