From f3f2f397fc63f28a77a3ba793073f758f2719df5 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 8afa8cb98..3c1af6b2e 100644 --- a/src/Handler/Utils/Avs.hs +++ b/src/Handler/Utils/Avs.hs @@ -717,7 +717,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 queueAvsUpdateByUID :: (MonoFoldable mono, UserId ~ Element mono) => mono -> Maybe Day -> DB Int64 queueAvsUpdateByUID uids = queueAvsUpdateAux (E.table @User) (E.^. UserId) (\usr -> usr E.^. UserId `E.in_` E.vals uids)