lpr: auth tag system-printer fully functional
This commit is contained in:
parent
841936178d
commit
1ea047263c
@ -22,6 +22,7 @@ UnauthorizedExamOffice: Sie sind nicht mit Prüfungsverwaltung beauftragt.
|
|||||||
UnauthorizedExamExamOffice: Es existieren keine Prüfungsergebnisse für Nutzer:innen, für die Sie mit der Prüfungsverwaltung beauftragt sind.
|
UnauthorizedExamExamOffice: Es existieren keine Prüfungsergebnisse für Nutzer:innen, für die Sie mit der Prüfungsverwaltung beauftragt sind.
|
||||||
UnauthorizedSchoolExamOffice: Sie sind nicht mit Prüfungsverwaltung für dieses Institut beauftragt.
|
UnauthorizedSchoolExamOffice: Sie sind nicht mit Prüfungsverwaltung für dieses Institut beauftragt.
|
||||||
UnauthorizedSystemExamOffice: Sie sind nicht mit systemweiter Prüfungsverwaltung beauftragt.
|
UnauthorizedSystemExamOffice: Sie sind nicht mit systemweiter Prüfungsverwaltung beauftragt.
|
||||||
|
UnauthorizedSystemPrinter: Sie sind nicht mit systemweitem Druck und Briefversand beauftragt.
|
||||||
UnauthorizedExternalExamExamOffice: Es existieren keine Prüfungsergebnisse für Nutzer:innen, für die Sie mit der Prüfungsverwaltung beauftragt sind.
|
UnauthorizedExternalExamExamOffice: Es existieren keine Prüfungsergebnisse für Nutzer:innen, für die Sie mit der Prüfungsverwaltung beauftragt sind.
|
||||||
UnauthorizedEvaluation: Sie sind nicht mit der Kursumfragenverwaltung beauftragt.
|
UnauthorizedEvaluation: Sie sind nicht mit der Kursumfragenverwaltung beauftragt.
|
||||||
UnauthorizedAllocationAdmin: Sie sind nicht mit der Administration von Zentralanmeldungen beauftragt.
|
UnauthorizedAllocationAdmin: Sie sind nicht mit der Administration von Zentralanmeldungen beauftragt.
|
||||||
|
|||||||
@ -23,7 +23,8 @@ UnauthorizedEvaluation: You are not charged with course evaluation.
|
|||||||
UnauthorizedAllocationAdmin: You are not charged with the administration of central allocations.
|
UnauthorizedAllocationAdmin: You are not charged with the administration of central allocations.
|
||||||
UnauthorizedExamExamOffice: You are not part of the appropriate exam office for any of the participants of this exam.
|
UnauthorizedExamExamOffice: You are not part of the appropriate exam office for any of the participants of this exam.
|
||||||
UnauthorizedSchoolExamOffice: You are not part of an exam office for this school.
|
UnauthorizedSchoolExamOffice: You are not part of an exam office for this school.
|
||||||
UnauthorizedSystemExamOffice: You are not charged with system wide exam administration
|
UnauthorizedSystemExamOffice: You are not charged with system wide exam administration.
|
||||||
|
UnauthorizedSystemPrinter: You are not charged with system wide letter printing.
|
||||||
UnauthorizedExternalExamExamOffice: You are not part of the appropriate exam office for any of the participants of this exam.
|
UnauthorizedExternalExamExamOffice: You are not part of the appropriate exam office for any of the participants of this exam.
|
||||||
UnauthorizedSchoolLecturer: You are no lecturer for this department.
|
UnauthorizedSchoolLecturer: You are no lecturer for this department.
|
||||||
UnauthorizedLecturer: You are no administrator for this course.
|
UnauthorizedLecturer: You are no administrator for this course.
|
||||||
|
|||||||
@ -14,3 +14,4 @@ BothSubmissions: Abgabe direkt in Uni2work oder extern mit Pseudonym
|
|||||||
SystemExamOffice: Prüfungsverwaltung
|
SystemExamOffice: Prüfungsverwaltung
|
||||||
SystemFaculty: Fakultätsmitglied
|
SystemFaculty: Fakultätsmitglied
|
||||||
SystemStudent: Student:in
|
SystemStudent: Student:in
|
||||||
|
SystemPrinter: Drucker:in
|
||||||
|
|||||||
@ -14,3 +14,4 @@ BothSubmissions: Submission either directly in Uni2work or externally via pseudo
|
|||||||
SystemExamOffice: Exam office
|
SystemExamOffice: Exam office
|
||||||
SystemFaculty: Faculty member
|
SystemFaculty: Faculty member
|
||||||
SystemStudent: Student
|
SystemStudent: Student
|
||||||
|
SystemPrinter: Printing staff
|
||||||
@ -9,6 +9,7 @@ AuthTagFree: Seite ist universell zugänglich
|
|||||||
AuthTagAdmin: Nutzer:in ist Administrator:in
|
AuthTagAdmin: Nutzer:in ist Administrator:in
|
||||||
AuthTagExamOffice: Nutzer:in ist mit Prüfungsverwaltung beauftragt
|
AuthTagExamOffice: Nutzer:in ist mit Prüfungsverwaltung beauftragt
|
||||||
AuthTagSystemExamOffice: Nutzer:in ist mit systemweiter Prüfungsverwaltung beauftragt
|
AuthTagSystemExamOffice: Nutzer:in ist mit systemweiter Prüfungsverwaltung beauftragt
|
||||||
|
AuthTagSystemPrinter: Nutzer:in ist mit systemweiten Druck von Briefen beauftragt
|
||||||
AuthTagEvaluation: Nutzer:in ist mit Kursumfragenverwaltung beauftragt
|
AuthTagEvaluation: Nutzer:in ist mit Kursumfragenverwaltung beauftragt
|
||||||
AuthTagAllocationAdmin: Nutzer:in ist mit der Administration von Zentralanmeldungen beauftragt
|
AuthTagAllocationAdmin: Nutzer:in ist mit der Administration von Zentralanmeldungen beauftragt
|
||||||
AuthTagToken: Nutzer:in präsentiert Authorisierungs-Token
|
AuthTagToken: Nutzer:in präsentiert Authorisierungs-Token
|
||||||
|
|||||||
@ -9,6 +9,7 @@ AuthTagFree: Page is freely accessable
|
|||||||
AuthTagAdmin: User is administrator
|
AuthTagAdmin: User is administrator
|
||||||
AuthTagExamOffice: User is part of an exam office
|
AuthTagExamOffice: User is part of an exam office
|
||||||
AuthTagSystemExamOffice: User is charged with system wide exam administration
|
AuthTagSystemExamOffice: User is charged with system wide exam administration
|
||||||
|
AuthTagSystemPrinter: User is responsible for system wide letter printing
|
||||||
AuthTagEvaluation: User is charged with course evaluation
|
AuthTagEvaluation: User is charged with course evaluation
|
||||||
AuthTagAllocationAdmin: User is charged with administration of central allocations
|
AuthTagAllocationAdmin: User is charged with administration of central allocations
|
||||||
AuthTagToken: User is presenting an authorisation-token
|
AuthTagToken: User is presenting an authorisation-token
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
Qualification
|
Qualification
|
||||||
-- INVARIANT: 2*refreshWithin < validDuration
|
-- INVARIANT: 2*refreshWithin < validDuration
|
||||||
school SchoolId --TODO: Ansprechpartner der Schule in Briefe erwähnen
|
school SchoolId --TODO: Ansprechpartner der Schule in Briefe erwähnen
|
||||||
shorthand (CI Text)
|
shorthand (CI Text)
|
||||||
name (CI Text)
|
name (CI Text)
|
||||||
description StoredMarkup Maybe -- user-defined large Html, ought to contain full description
|
description StoredMarkup Maybe -- user-defined large Html, ought to contain full description
|
||||||
validDuration Word Maybe -- qualification is valid indefinitely or for a specified number of months
|
validDuration Word Maybe -- qualification is valid indefinitely or for a specified number of months
|
||||||
auditDuration Word Maybe -- number of month to keep audit log; or indefinitely
|
auditDuration Word Maybe -- number of month to keep audit log; or indefinitely
|
||||||
refreshWithin CalendarDiffDays Maybe -- notify users about renewal within this number of month/days before expiry
|
refreshWithin CalendarDiffDays Maybe -- notify users about renewal within this number of month/days before expiry
|
||||||
elearningStart Bool -- automatically schedule e-refresher
|
elearningStart Bool -- automatically schedule e-refresher
|
||||||
|
|||||||
4
routes
4
routes
@ -63,9 +63,9 @@
|
|||||||
/admin/crontab AdminCrontabR GET
|
/admin/crontab AdminCrontabR GET
|
||||||
/admin/avs AdminAvsR GET POST
|
/admin/avs AdminAvsR GET POST
|
||||||
|
|
||||||
/print PrintCenterR GET POST
|
/print PrintCenterR GET POST !system-printer
|
||||||
/print/send PrintSendR GET POST
|
/print/send PrintSendR GET POST
|
||||||
/print/download/#CryptoUUIDPrintJob PrintDownloadR GET
|
/print/download/#CryptoUUIDPrintJob PrintDownloadR GET !system-printer
|
||||||
|
|
||||||
/health HealthR GET !free
|
/health HealthR GET !free
|
||||||
/instance InstanceR GET !free
|
/instance InstanceR GET !free
|
||||||
|
|||||||
@ -475,7 +475,7 @@ pgCEditR tid ssh csh = do
|
|||||||
-- | since an edit is identified via cfCourseId which is not contained in the received form data for security reasons!
|
-- | since an edit is identified via cfCourseId which is not contained in the received form data for security reasons!
|
||||||
courseEditHandler :: (forall p. PathPiece p => p -> Maybe (SomeRoute UniWorX)) -> Maybe CourseForm -> Handler Html
|
courseEditHandler :: (forall p. PathPiece p => p -> Maybe (SomeRoute UniWorX)) -> Maybe CourseForm -> Handler Html
|
||||||
courseEditHandler miButtonAction mbCourseForm = do
|
courseEditHandler miButtonAction mbCourseForm = do
|
||||||
aid <- requireAuthId -- TODO: Verify that Editor is owner of the Course to be Edited!!!
|
aid <- requireAuthId
|
||||||
((result, formWidget), formEnctype) <- runFormPost $ makeCourseForm miButtonAction mbCourseForm
|
((result, formWidget), formEnctype) <- runFormPost $ makeCourseForm miButtonAction mbCourseForm
|
||||||
formResult result $ \case
|
formResult result $ \case
|
||||||
res@CourseForm
|
res@CourseForm
|
||||||
|
|||||||
@ -13,3 +13,4 @@ determineSystemFunctions ldapFuncs = \case
|
|||||||
SystemFaculty -> "CN=PROJ-Fahrerausbildung Admin_rw,OU=Projekte,OU=Sicherheitsgruppen,DC=fra,DC=fraport,DC=de" `Set.member` ldapFuncs -- Fahrerausbildungadmins are lecturers
|
SystemFaculty -> "CN=PROJ-Fahrerausbildung Admin_rw,OU=Projekte,OU=Sicherheitsgruppen,DC=fra,DC=fraport,DC=de" `Set.member` ldapFuncs -- Fahrerausbildungadmins are lecturers
|
||||||
-- SJ: not sure this LDAP-specific key belongs here?
|
-- SJ: not sure this LDAP-specific key belongs here?
|
||||||
SystemStudent -> False -- "student" `Set.member` ldapFuncs -- no such key identified at FraPort
|
SystemStudent -> False -- "student" `Set.member` ldapFuncs -- no such key identified at FraPort
|
||||||
|
SystemPrinter -> False -- "department=IFM-IS2" zu viele Mitglieder
|
||||||
|
|||||||
@ -38,22 +38,27 @@ dispatchNotificationQualificationExpiry nQualification _nExpiry jRecipient = use
|
|||||||
addHtmlMarkdownAlternatives $(ihamletFile "templates/mail/qualificationExpiry.hamlet")
|
addHtmlMarkdownAlternatives $(ihamletFile "templates/mail/qualificationExpiry.hamlet")
|
||||||
|
|
||||||
|
|
||||||
checkEmailOk :: a -> Bool
|
checkEmailOk :: User -> Bool
|
||||||
checkEmailOk = const True -- TODO
|
checkEmailOk = const True -- TODO
|
||||||
|
|
||||||
|
|
||||||
dispatchNotificationQualificationRenewal :: QualificationId -> UserId -> Handler ()
|
dispatchNotificationQualificationRenewal :: QualificationId -> UserId -> Handler ()
|
||||||
dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
||||||
(User{..}, Qualification{..}, Entity _ QualificationUser{..}) <- runDB $ (,,)
|
(recipient@User{..}, Qualification{..}, Entity _ QualificationUser{..}) <- runDB $ (,,)
|
||||||
<$> getJust jRecipient
|
<$> getJust jRecipient
|
||||||
<*> getJust nQualification
|
<*> getJust nQualification
|
||||||
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
<*> getJustBy (UniqueQualificationUser nQualification jRecipient)
|
||||||
let qname = CI.original qualificationName
|
let entRecipient = Entity jRecipient recipient
|
||||||
|
qname = CI.original qualificationName
|
||||||
-- content = $(i18nWidgetFile "qualification/renewal")
|
-- content = $(i18nWidgetFile "qualification/renewal")
|
||||||
$logDebugS "LMS" $ "Notify " <> tshow jRecipient <> " for renewal of qualification " <> qname
|
$logDebugS "LMS" $ "Notify " <> tshow jRecipient <> " for renewal of qualification " <> qname
|
||||||
|
|
||||||
|
now <- liftIO getCurrentTime
|
||||||
|
letterDate <- formatTimeUser SelFormatDate now $ Just entRecipient
|
||||||
let pdfMeta = applyMetas
|
let pdfMeta = applyMetas
|
||||||
[ ("recipient", userDisplayName)
|
[ ("recipient", userDisplayName)
|
||||||
|
, ("date" , letterDate)
|
||||||
|
, ("lang" , selectDeEn userLanguages) -- select German or English, see Utils.Lang
|
||||||
-- TODO: add more info to interpolate here!
|
-- TODO: add more info to interpolate here!
|
||||||
] mempty
|
] mempty
|
||||||
pdfRenewal pdfMeta >>= \case
|
pdfRenewal pdfMeta >>= \case
|
||||||
@ -61,7 +66,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
let msg = "Notify " <> tshow jRecipient <> " PDF generation failed with error: " <> err
|
let msg = "Notify " <> tshow jRecipient <> " PDF generation failed with error: " <> err
|
||||||
$logErrorS "LMS" msg
|
$logErrorS "LMS" msg
|
||||||
error $ unpack msg
|
error $ unpack msg
|
||||||
Right pdf | checkEmailOk userEmail -> userMailT jRecipient $ do
|
Right pdf | checkEmailOk recipient -> userMailT jRecipient $ do
|
||||||
|
|
||||||
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
||||||
setSubjectI $ MsgMailSubjectQualificationRenewal qname
|
setSubjectI $ MsgMailSubjectQualificationRenewal qname
|
||||||
@ -69,8 +74,7 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
|||||||
editNotifications <- mkEditNotifications jRecipient -- TODO: add to hamlet file again
|
editNotifications <- mkEditNotifications jRecipient -- TODO: add to hamlet file again
|
||||||
-- let msgrenewal = $(i18nHamletFile "qualification/renewal") -- :: HtmlUrlI18n (SomeMessage UniWorX) (Route UniWorX)
|
-- let msgrenewal = $(i18nHamletFile "qualification/renewal") -- :: HtmlUrlI18n (SomeMessage UniWorX) (Route UniWorX)
|
||||||
-- addHtmlMarkdownAlternatives' msgrenewal
|
-- addHtmlMarkdownAlternatives' msgrenewal
|
||||||
|
|
||||||
now <- liftIO getCurrentTime
|
|
||||||
encryptPDF "tomatenmarmelade" pdf >>= \case
|
encryptPDF "tomatenmarmelade" pdf >>= \case
|
||||||
Left err -> do
|
Left err -> do
|
||||||
let msg = "Notify " <> tshow jRecipient <> " PDF encryption failed with error: " <> err
|
let msg = "Notify " <> tshow jRecipient <> " PDF encryption failed with error: " <> err
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import Model.Types.TH.JSON
|
|||||||
import Control.Lens.TH (makeWrapped)
|
import Control.Lens.TH (makeWrapped)
|
||||||
|
|
||||||
|
|
||||||
newtype Languages = Languages [Lang]
|
newtype Languages = Languages { getLanguages :: [Lang] }
|
||||||
deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
deriving (Eq, Ord, Show, Read, Generic, Typeable)
|
||||||
deriving newtype (FromJSON, ToJSON, IsList)
|
deriving newtype (FromJSON, ToJSON, IsList)
|
||||||
|
|
||||||
|
|||||||
@ -75,6 +75,7 @@ data AuthTag -- sortiert nach gewünschter Reihenfolge auf /authpreds, d.h. Prä
|
|||||||
| AuthTutorControl
|
| AuthTutorControl
|
||||||
| AuthExamOffice
|
| AuthExamOffice
|
||||||
| AuthSystemExamOffice
|
| AuthSystemExamOffice
|
||||||
|
| AuthSystemPrinter
|
||||||
| AuthEvaluation
|
| AuthEvaluation
|
||||||
| AuthAllocationAdmin
|
| AuthAllocationAdmin
|
||||||
| AuthAllocationRegistered
|
| AuthAllocationRegistered
|
||||||
|
|||||||
@ -2,6 +2,7 @@ module Utils.Lang where
|
|||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|
||||||
|
import Model.Types.Languages
|
||||||
import Utils.Cookies.Registered
|
import Utils.Cookies.Registered
|
||||||
import Utils.Parameters
|
import Utils.Parameters
|
||||||
import Utils.Session
|
import Utils.Session
|
||||||
@ -31,6 +32,16 @@ isDe = isPrefixOf "de"
|
|||||||
isEn :: Lang -> Bool
|
isEn :: Lang -> Bool
|
||||||
isEn = isPrefixOf "en"
|
isEn = isPrefixOf "en"
|
||||||
|
|
||||||
|
selectDeEn :: Maybe Languages -> Lang
|
||||||
|
selectDeEn = selectLanguage' availableLanguages . concatMap getLanguages
|
||||||
|
where
|
||||||
|
availableLanguages = "de" :| ["en"] -- for now, we only have german and english, with german being the default language
|
||||||
|
|
||||||
|
selectEnDe :: Maybe Languages -> Lang
|
||||||
|
selectEnDe = selectLanguage' availableLanguages . concatMap getLanguages
|
||||||
|
where
|
||||||
|
availableLanguages = "en" :| ["de"]
|
||||||
|
|
||||||
selectLanguage :: MonadHandler m
|
selectLanguage :: MonadHandler m
|
||||||
=> NonEmpty Lang -- ^ Available translations, first is default
|
=> NonEmpty Lang -- ^ Available translations, first is default
|
||||||
-> m Lang
|
-> m Lang
|
||||||
|
|||||||
Reference in New Issue
Block a user