refacor(lms): log messages no longer track unencrypted userID
This commit is contained in:
parent
68bd7ff51b
commit
227970e4b1
@ -30,12 +30,13 @@ dispatchNotificationQualificationExpiry nQualification _nExpiry jRecipient = use
|
|||||||
<$> getJust jRecipient
|
<$> getJust jRecipient
|
||||||
<*> getJust nQualification
|
<*> getJust nQualification
|
||||||
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
||||||
|
|
||||||
|
encRecipient :: CryptoUUIDUser <- liftHandler $ encrypt jRecipient
|
||||||
let entRecipient = Entity jRecipient recipient
|
let entRecipient = Entity jRecipient recipient
|
||||||
qname = CI.original qualificationName
|
qname = CI.original qualificationName
|
||||||
expiryDate <- formatTimeUser SelFormatDate qualificationUserValidUntil $ Just entRecipient
|
expiryDate <- formatTimeUser SelFormatDate qualificationUserValidUntil $ Just entRecipient
|
||||||
|
|
||||||
$logDebugS "LMS" $ "Notify " <> tshow jRecipient <> " about expiry of qualification " <> qname
|
$logDebugS "LMS" $ "Notify " <> tshow encRecipient <> " about expiry of qualification " <> qname
|
||||||
|
|
||||||
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
||||||
setSubjectI $ MsgMailSubjectQualificationExpiry qname
|
setSubjectI $ MsgMailSubjectQualificationExpiry qname
|
||||||
@ -53,10 +54,12 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
<*> getJust nQualification
|
<*> getJust nQualification
|
||||||
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
||||||
<*> getJustBy (UniqueLmsQualificationUser nQualification jRecipient)
|
<*> getJustBy (UniqueLmsQualificationUser nQualification jRecipient)
|
||||||
|
|
||||||
|
encRecipient :: CryptoUUIDUser <- encrypt jRecipient
|
||||||
let entRecipient = Entity jRecipient recipient
|
let entRecipient = Entity jRecipient recipient
|
||||||
qname = CI.original qualificationName
|
qname = CI.original qualificationName
|
||||||
|
|
||||||
$logDebugS "LMS" $ "Notify " <> tshow jRecipient <> " for renewal of qualification " <> qname
|
$logDebugS "LMS" $ "Notify " <> tshow encRecipient <> " for renewal of qualification " <> qname
|
||||||
|
|
||||||
now <- liftIO getCurrentTime
|
now <- liftIO getCurrentTime
|
||||||
letterDate <- formatTimeUser SelFormatDate now $ Just entRecipient
|
letterDate <- formatTimeUser SelFormatDate now $ Just entRecipient
|
||||||
@ -76,7 +79,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
]
|
]
|
||||||
pdfRenewal pdfMeta >>= \case
|
pdfRenewal pdfMeta >>= \case
|
||||||
Left err -> do
|
Left err -> do
|
||||||
let msg = "Notify " <> tshow jRecipient <> " PDF generation failed with error: " <> err
|
let msg = "Notify " <> tshow encRecipient <> " PDF generation failed with error: " <> err
|
||||||
$logErrorS "LMS" msg
|
$logErrorS "LMS" msg
|
||||||
error $ unpack msg
|
error $ unpack msg
|
||||||
|
|
||||||
@ -84,7 +87,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
let printSender = Nothing
|
let printSender = Nothing
|
||||||
runDB (sendLetter printJobName pdf printSender (Just jRecipient) Nothing (Just nQualification)) >>= \case
|
runDB (sendLetter printJobName pdf printSender (Just jRecipient) Nothing (Just nQualification)) >>= \case
|
||||||
Left err -> do
|
Left err -> do
|
||||||
let msg = "Notify " <> tshow jRecipient <> " PDF printing to send letter failed with error: " <> err
|
let msg = "Notify " <> tshow encRecipient <> " PDF printing to send letter failed with error: " <> err
|
||||||
$logErrorS "LMS" msg
|
$logErrorS "LMS" msg
|
||||||
error $ unpack msg
|
error $ unpack msg
|
||||||
Right (msg,_)
|
Right (msg,_)
|
||||||
@ -93,7 +96,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
|
|
||||||
Right pdf -> userMailT jRecipient $ do
|
Right pdf -> userMailT jRecipient $ do
|
||||||
-- userPrefersLetter is false if both userEmail and userPostAddress are null
|
-- userPrefersLetter is false if both userEmail and userPostAddress are null
|
||||||
when (Text.null (CI.original userEmail)) $ $logErrorS "LMS" ("Notify " <> tshow jRecipient <> " failed: no email nor address for user known!")
|
when (Text.null (CI.original userEmail)) $ $logErrorS "LMS" ("Notify " <> tshow encRecipient <> " failed: no email nor address for user known!")
|
||||||
|
|
||||||
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
||||||
setSubjectI $ MsgMailSubjectQualificationRenewal qname
|
setSubjectI $ MsgMailSubjectQualificationRenewal qname
|
||||||
@ -102,7 +105,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
|
|
||||||
encryptPDF (fromMaybe "tomatenmarmelade" userPinPassword) pdf >>= \case -- TODO
|
encryptPDF (fromMaybe "tomatenmarmelade" userPinPassword) pdf >>= \case -- TODO
|
||||||
Left err -> do
|
Left err -> do
|
||||||
let msg = "Notify " <> tshow jRecipient <> " PDF encryption failed with error: " <> err
|
let msg = "Notify " <> tshow encRecipient <> " PDF encryption failed with error: " <> err
|
||||||
$logErrorS "LMS" msg
|
$logErrorS "LMS" msg
|
||||||
|
|
||||||
Right pdffile -> do
|
Right pdffile -> do
|
||||||
|
|||||||
Reference in New Issue
Block a user