chore(letter): letters may choose attachment encryption
This commit is contained in:
parent
2b745a4520
commit
ee9481ebd8
@ -251,7 +251,11 @@ sendEmailOrLetter recipient letter = do
|
||||
$logWarnS "LETTER" $ "PDF printing to send letter with lpr returned ExitSuccess and the following message: " <> msg
|
||||
return True
|
||||
Right pdf -> do -- send email
|
||||
attachment <- case underling ^. _userPinPassword of
|
||||
let pdfPass = case encrypPDFfor (pure letter) of
|
||||
NoPassword -> Nothing
|
||||
PasswordSupervisor -> rcvrUsr ^. _userPinPassword
|
||||
PasswordUnderling -> underling ^. _userPinPassword
|
||||
attachment <- case pdfPass of
|
||||
Nothing -> return pdf
|
||||
Just passwd -> encryptPDF passwd pdf >>= \case
|
||||
Right encPdf -> return encPdf
|
||||
|
||||
@ -214,6 +214,9 @@ convertProto _ (IsMeta v) = v
|
||||
convertProto f (IsTime t) = P.toMetaValue $ f t
|
||||
-}
|
||||
|
||||
data EncryptPDFfor = NoPassword | PasswordSupervisor | PasswordUnderling
|
||||
deriving (Eq, Show)
|
||||
|
||||
class MDLetter l where
|
||||
getMailSubject :: l -> SomeMessage UniWorX -- only used if letter is sent by email as pdf attachment
|
||||
getMailBody :: l -> DateTimeFormatter -> HtmlUrlI18n (SomeMessage UniWorX) (Route UniWorX) -- only used if letter is sent by email as pdf attachment
|
||||
@ -221,7 +224,8 @@ class MDLetter l where
|
||||
getPJId :: l -> PrintJobIdentification
|
||||
getLetterEnvelope :: l -> Char
|
||||
getLetterKind :: Proxy l -> LetterKind
|
||||
getTemplate :: Proxy l -> Text
|
||||
getTemplate :: Proxy l -> Text
|
||||
encrypPDFfor :: Proxy l -> EncryptPDFfor
|
||||
|
||||
letterApcIdent :: (MDLetter l, MonadHandler m) => l -> CryptoUUIDUser -> UTCTime -> m Text
|
||||
letterApcIdent l uuid now = do
|
||||
|
||||
@ -47,6 +47,7 @@ letterRenewalQualificationFData LetterRenewQualificationF{lmsLogin} = LetterRene
|
||||
lmsIdent = getLmsIdent lmsLogin
|
||||
|
||||
instance MDLetter LetterRenewQualificationF where
|
||||
encrypPDFfor _ = PasswordUnderling
|
||||
getLetterKind _ = PinLetter
|
||||
getLetterEnvelope l = maybe 'q' (Char.toLower . fst) $ Text.uncons (qualShort l)
|
||||
getTemplate _ = decodeUtf8 $(Data.FileEmbed.embedFile "templates/letter/fraport_renewal.md")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user