fix(ldap): match mobile number better between LDAP and AVS
This commit is contained in:
parent
f108c6cfec
commit
47e56280fc
@ -182,7 +182,6 @@ upsertCampusUser upsertMode ldapData = do
|
|||||||
userDefaultConf <- getsYesod $ view _appUserDefaults
|
userDefaultConf <- getsYesod $ view _appUserDefaults
|
||||||
|
|
||||||
(newUser,userUpdate) <- decodeUser now userDefaultConf upsertMode ldapData
|
(newUser,userUpdate) <- decodeUser now userDefaultConf upsertMode ldapData
|
||||||
--TODO: newUser should be associated with a company and company supervisor through Handler.Utils.Company.oldUpsertUserCompany, but this is called by upsertAvsUser already - conflict?
|
|
||||||
|
|
||||||
oldUsers <- for (userLdapPrimaryKey newUser) $ \pKey -> selectKeysList [ UserLdapPrimaryKey ==. Just pKey ] []
|
oldUsers <- for (userLdapPrimaryKey newUser) $ \pKey -> selectKeysList [ UserLdapPrimaryKey ==. Just pKey ] []
|
||||||
|
|
||||||
@ -230,8 +229,8 @@ decodeUserTest mbIdent ldapData = do
|
|||||||
decodeUser :: (MonadThrow m) => UTCTime -> UserDefaultConf -> UpsertCampusUserMode -> Ldap.AttrList [] -> m (User,_)
|
decodeUser :: (MonadThrow m) => UTCTime -> UserDefaultConf -> UpsertCampusUserMode -> Ldap.AttrList [] -> m (User,_)
|
||||||
decodeUser now UserDefaultConf{..} upsertMode ldapData = do
|
decodeUser now UserDefaultConf{..} upsertMode ldapData = do
|
||||||
let
|
let
|
||||||
userTelephone = decodeLdap ldapUserTelephone
|
userTelephone = decodeLdap ldapUserTelephone <&> canonicalPhone
|
||||||
userMobile = decodeLdap ldapUserMobile
|
userMobile = decodeLdap ldapUserMobile <&> canonicalPhone
|
||||||
userCompanyPersonalNumber = decodeLdap ldapUserFraportPersonalnummer
|
userCompanyPersonalNumber = decodeLdap ldapUserFraportPersonalnummer
|
||||||
userCompanyDepartment = decodeLdap ldapUserFraportAbteilung
|
userCompanyDepartment = decodeLdap ldapUserFraportAbteilung
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,13 @@ canonicalPhone pn
|
|||||||
| otherwise
|
| otherwise
|
||||||
= Text.map repl_nondigit pn
|
= Text.map repl_nondigit pn
|
||||||
where
|
where
|
||||||
|
-- split_area :: Text -> Char -> Int -> Text -> Text
|
||||||
|
-- split_area c f p n =
|
||||||
|
-- let (area,sufx) = Text.splitAt p $ Text.filter Char.isDigit n
|
||||||
|
-- in c <> Text.cons f area <> Text.cons ' ' sufx
|
||||||
|
|
||||||
german_mobile :: Text -> Text
|
german_mobile :: Text -> Text
|
||||||
|
--german_mobile = split_area "+49" '1' 2
|
||||||
german_mobile wpx =
|
german_mobile wpx =
|
||||||
let (area,endnr) = Text.splitAt 2 $ Text.filter Char.isDigit wpx
|
let (area,endnr) = Text.splitAt 2 $ Text.filter Char.isDigit wpx
|
||||||
in "+49 1" <> area <> Text.cons ' ' endnr
|
in "+49 1" <> area <> Text.cons ' ' endnr
|
||||||
|
|||||||
Reference in New Issue
Block a user