diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b83f02c..1b344ce5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [26.6.3](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.6.2...v26.6.3) (2022-11-30) + + +### Bug Fixes + +* **avs:** normalize internal personal numbers between LDAP and AVS ([b20008d](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/commit/b20008d3bcb730ff76a76ce2928364e6ce9e7c35)) + ## [26.6.2](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.6.1...v26.6.2) (2022-11-29) ## [26.6.1](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.6.0...v26.6.1) (2022-11-28) diff --git a/messages/uniworx/categories/settings/personal_settings/de-de-formal.msg b/messages/uniworx/categories/settings/personal_settings/de-de-formal.msg index 06b915786..147d89ded 100644 --- a/messages/uniworx/categories/settings/personal_settings/de-de-formal.msg +++ b/messages/uniworx/categories/settings/personal_settings/de-de-formal.msg @@ -27,7 +27,11 @@ ProfileCorrectorRemark: Die oberhalb angezeigte Tabelle zeigt nur prinzipielle E ProfileCorrections: Auflistung aller zugewiesenen Korrekturen Remarks: Hinweise +ProfileSupervisor: Übergeordnete Ansprechpartner +ProfileSupervisee: Ist Ansprechpartner für + UserTelephone: Telefon UserMobile: Mobiltelefon +Company: Firmenzugehörigkeit CompanyPersonalNumber: Personalnummer (nur Fraport AG) CompanyDepartment: Abteilung \ No newline at end of file diff --git a/messages/uniworx/categories/settings/personal_settings/en-eu.msg b/messages/uniworx/categories/settings/personal_settings/en-eu.msg index e39556769..cc3c63c19 100644 --- a/messages/uniworx/categories/settings/personal_settings/en-eu.msg +++ b/messages/uniworx/categories/settings/personal_settings/en-eu.msg @@ -27,7 +27,11 @@ ProfileCorrectorRemark: The table above only shows registration as a corrector i ProfileCorrections: List of all assigned corrections Remarks: Remarks +ProfileSupervisor: Supervised by +ProfileSupervisee: Supervises + UserTelephone: Phone UserMobile: Mobile +Company: Company affilitaion CompanyPersonalNumber: Personnel number (Fraport AG only) CompanyDepartment: Department \ No newline at end of file diff --git a/nix/docker/demo-version.json b/nix/docker/demo-version.json index d44322bc1..c24d415e3 100644 --- a/nix/docker/demo-version.json +++ b/nix/docker/demo-version.json @@ -1,3 +1,3 @@ { - "version": "26.6.2" + "version": "26.6.3" } diff --git a/nix/docker/version.json b/nix/docker/version.json index d44322bc1..c24d415e3 100644 --- a/nix/docker/version.json +++ b/nix/docker/version.json @@ -1,3 +1,3 @@ { - "version": "26.6.2" + "version": "26.6.3" } diff --git a/package-lock.json b/package-lock.json index 13ff6a7f5..9df0c2462 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "uni2work", - "version": "26.6.2", + "version": "26.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 941b8a803..a22d00fa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uni2work", - "version": "26.6.2", + "version": "26.6.3", "description": "", "keywords": [], "author": "", diff --git a/package.yaml b/package.yaml index 7c89d013f..f715bedb6 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: uniworx -version: 26.6.2 +version: 26.6.3 dependencies: - base - yesod diff --git a/src/Handler/Admin/Avs.hs b/src/Handler/Admin/Avs.hs index b438803cd..9bff17398 100644 --- a/src/Handler/Admin/Avs.hs +++ b/src/Handler/Admin/Avs.hs @@ -4,7 +4,7 @@ module Handler.Admin.Avs ( getAdminAvsR - , postAdminAvsR + , postAdminAvsR ) where import Import @@ -28,24 +28,29 @@ nullaryPathPiece ''ButtonAvsTest camelToPathPiece instance Button UniWorX ButtonAvsTest where btnLabel BtnCheckLicences = "Check all licences" -- could be msg - btnClasses BtnCheckLicences = [BCIsButton, BCPrimary] + btnClasses BtnCheckLicences = [BCIsButton, BCPrimary] -- END Button avsCardNoField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m AvsCardNo avsCardNoField = convertField AvsCardNo avsCardNo textField +avsInternalPersonalNoField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m AvsInternalPersonalNo +avsInternalPersonalNoField = convertField (canonical . AvsInternalPersonalNo) avsInternalPersonalNo textField + makeAvsPersonForm :: Maybe AvsQueryPerson -> Form AvsQueryPerson -makeAvsPersonForm tmpl = identifyForm FIDAvsQueryPerson . validateForm validateAvsQueryPerson $ \html -> - flip (renderAForm FormStandard) html $ AvsQueryPerson +makeAvsPersonForm tmpl = identifyForm FIDAvsQueryPerson . validateForm validateAvsQueryPerson $ \html -> + flip (renderAForm FormStandard) html $ AvsQueryPerson <$> aopt avsCardNoField (fslI MsgAvsCardNo) (avsPersonQueryCardNo <$> tmpl) + <*> aopt textField (fslI MsgAvsVersionNo) (avsPersonQueryVersionNo <$> tmpl) <*> aopt textField (fslI MsgAvsFirstName) (avsPersonQueryFirstName <$> tmpl) <*> aopt textField (fslI MsgAvsLastName) (avsPersonQueryLastName <$> tmpl) - <*> aopt textField (fslI MsgAvsInternalPersonalNo) (avsPersonQueryInternalPersonalNo <$> tmpl) - <*> aopt textField (fslI MsgAvsVersionNo) (avsPersonQueryVersionNo <$> tmpl) + <*> aopt avsInternalPersonalNoField + (fslI MsgAvsInternalPersonalNo) (avsPersonQueryInternalPersonalNo <$> tmpl) + validateAvsQueryPerson :: FormValidator AvsQueryPerson Handler () -validateAvsQueryPerson = do +validateAvsQueryPerson = do AvsQueryPerson{..} <- State.get guardValidation MsgAvsQueryEmpty $ is _Just avsPersonQueryCardNo || @@ -55,31 +60,31 @@ validateAvsQueryPerson = do is _Just avsPersonQueryVersionNo makeAvsStatusForm :: Maybe AvsQueryStatus -> Form AvsQueryStatus -makeAvsStatusForm tmpl = identifyForm FIDAvsQueryStatus . validateForm validateAvsQueryStatus $ \html -> +makeAvsStatusForm tmpl = identifyForm FIDAvsQueryStatus . validateForm validateAvsQueryStatus $ \html -> flip (renderAForm FormStandard) html $ parseAvsIds <$> areq textField (fslI MsgAvsPersonId) (unparseAvsIds <$> tmpl) where parseAvsIds :: Text -> AvsQueryStatus parseAvsIds txt = AvsQueryStatus $ Set.fromList ids - where - nonemptys = filter (not . Text.null) $ Text.strip <$> Text.split (==',') txt + where + nonemptys = filter (not . Text.null) $ Text.strip <$> Text.split (==',') txt ids = catMaybes $ readMay <$> nonemptys - unparseAvsIds :: AvsQueryStatus -> Text - unparseAvsIds (AvsQueryStatus ids) = Text.intercalate ", " $ tshow <$> Set.toAscList ids + unparseAvsIds :: AvsQueryStatus -> Text + unparseAvsIds (AvsQueryStatus ids) = Text.intercalate ", " $ tshow <$> Set.toAscList ids validateAvsQueryStatus :: FormValidator AvsQueryStatus Handler () -validateAvsQueryStatus = do +validateAvsQueryStatus = do AvsQueryStatus ids <- State.get guardValidation (MsgAvsQueryStatusInvalid $ tshow ids) $ not (null ids) avsLicenceOptions :: OptionList AvsLicence -avsLicenceOptions = mkOptionList - [ Option +avsLicenceOptions = mkOptionList + [ Option { optionDisplay = Text.singleton $ licence2char l , optionInternalValue = l , optionExternalValue = toJsonText l - } + } | l <- universeF ] @@ -92,27 +97,30 @@ postAdminAvsR = do Just AvsQuery{..} -> do ((presult, pwidget), penctype) <- runFormPost $ makeAvsPersonForm Nothing - let procFormPerson fr = do + let procFormPerson fr = do + addMessage Info $ text2Html $ "Query: " <> tshow (toJSON fr) res <- avsQueryPerson fr - case res of - Left err -> return . Just $ tshow err + case res of + Left err -> return . Just $ tshow err Right jsn -> return . Just $ tshow jsn mbPerson <- formResultMaybe presult procFormPerson ((sresult, swidget), senctype) <- runFormPost $ makeAvsStatusForm Nothing - let procFormStatus fr = do + let procFormStatus fr = do + addMessage Info $ text2Html $ "Query: " <> tshow (toJSON fr) res <- avsQueryStatus fr - case res of - Left err -> return . Just $ tshow err - Right jsn -> return . Just $ tshow jsn + case res of + Left err -> return . Just $ tshow err + Right jsn -> return . Just $ tshow jsn mbStatus <- formResultMaybe sresult procFormStatus - ((crUsrRes, crUsrWgt), crUsrEnctype) <- runFormPost $ identifyForm FIDAvsCreateUser $ \html -> + ((crUsrRes, crUsrWgt), crUsrEnctype) <- runFormPost $ identifyForm FIDAvsCreateUser $ \html -> flip (renderAForm FormStandard) html $ areq textField (fslI MsgAvsCardNo) Nothing - let procFormCrUsr fr = do + let procFormCrUsr fr = do + -- addMessage Info $ text2Html $ "Query: " <> tshow (toJSON fr) res <- try $ upsertAvsUser fr - case res of - (Right (Just uid)) -> do + case res of + (Right (Just uid)) -> do uuid :: CryptoUUIDUser <- encrypt uid return $ Just [whamlet|

Success:

User created or updated.|] (Right Nothing) -> @@ -122,27 +130,46 @@ postAdminAvsR = do return $ Just [whamlet|

Error:

#{msg}|] mbCrUser <- formResultMaybe crUsrRes procFormCrUsr - ((getLicRes, getLicWgt), getLicEnctype) <- runFormPost $ identifyForm FIDAvsQueryLicence $ \html -> - flip (renderAForm FormStandard) html $ areq intField (fslI MsgAvsPersonId) Nothing - let procFormGetLic fr = do - res <- try $ getLicenceByAvsId $ AvsPersonId fr - case res of - (Right (Just lic)) -> - return $ Just [whamlet|

Success:

Licence #{tshow lic}|] - (Right Nothing) -> - return $ Just [whamlet|

Warning:

User not found.|] - (Left e) -> do - let msg = tshow (e :: SomeException) + ((getLicRes, getLicWgt), getLicEnctype) <- runFormPost $ identifyForm FIDAvsQueryLicence $ \html -> + flip (renderAForm FormStandard) html $ (,,) <$> aopt intField (fslI $ text2message "Min AvsPersonId") Nothing + <*> aopt intField (fslI $ text2message "Max AvsPersonId") Nothing + <*> aopt (selectField $ return avsLicenceOptions) (fslI MsgAvsLicence) Nothing + let procFormGetLic fr = do + res <- avsQueryGetAllLicences + case res of + (Right (AvsResponseGetLicences lics)) -> do + let flics = Set.toList $ Set.filter lfltr lics + lfltr = case fr of -- not pretty, but it'll do + (Just idmin, Just idmax, Just lic) -> \AvsPersonLicence{..} -> (avsLicenceRampLicence == lic) && (avsLicencePersonID `inBetween` (AvsPersonId idmin, AvsPersonId idmax)) + (Just idmin, Nothing, Just lic) -> \AvsPersonLicence{..} -> (avsLicenceRampLicence == lic) && (avsLicencePersonID == AvsPersonId idmin) + (Nothing , Just idmax, Just lic) -> \AvsPersonLicence{..} -> (avsLicenceRampLicence == lic) && (avsLicencePersonID == AvsPersonId idmax) + (Nothing , Nothing, Just lic) -> \AvsPersonLicence{..} -> avsLicenceRampLicence == lic + (Just idmin, Just idmax, Nothing ) -> (`inBetween` (AvsPersonId idmin, AvsPersonId idmax)) . avsLicencePersonID + (Just idmin, Nothing, Nothing ) -> (== AvsPersonId idmin) . avsLicencePersonID + (Nothing , Just idmax, Nothing ) -> (== AvsPersonId idmax) . avsLicencePersonID + (Nothing , Nothing, Nothing ) -> const True + addMessage Info $ text2Html $ "Query returned " <> tshow (length flics) <> " licences." + return $ Just [whamlet| +

Success:

+