fix(users): fallback email to name

This commit is contained in:
Gregor Kleen 2019-10-15 15:17:01 +02:00
parent e28837ed6a
commit 7bf018c2a4
2 changed files with 10 additions and 9 deletions

View File

@ -47,10 +47,12 @@ findUser LdapConf{..} ldap ident retAttrs = fromMaybe [] <$> findM (assertM (not
userFilters = userFilters =
[ ldapUserPrincipalName Ldap.:= Text.encodeUtf8 ident [ ldapUserPrincipalName Ldap.:= Text.encodeUtf8 ident
, ldapUserPrincipalName Ldap.:= Text.encodeUtf8 [st|#{ident}@campus.lmu.de|] , ldapUserPrincipalName Ldap.:= Text.encodeUtf8 [st|#{ident}@campus.lmu.de|]
, ldapUserEmail Ldap.:= Text.encodeUtf8 ident ] ++
, ldapUserEmail Ldap.:= Text.encodeUtf8 [st|#{ident}@lmu.de|] [ ldapUserEmail' Ldap.:= Text.encodeUtf8 ident'
, ldapUserEmail Ldap.:= Text.encodeUtf8 [st|#{ident}@campus.lmu.de|] | ident' <- [ident, [st|#{ident}@lmu.de|], [st|#{ident}@campus.lmu.de|]]
, ldapUserDisplayName Ldap.:= Text.encodeUtf8 ident , ldapUserEmail' <- toList ldapUserEmail
] ++
[ ldapUserDisplayName Ldap.:= Text.encodeUtf8 ident
] ]
userSearchSettings = mconcat userSearchSettings = mconcat
[ Ldap.scope ldapScope [ Ldap.scope ldapScope
@ -71,10 +73,9 @@ ldapUserFieldName = Ldap.Attr "dfnEduPersonFieldOfStudyString"
ldapUserSchoolAssociation = Ldap.Attr "LMU-IFI-eduPersonOrgUnitDNString" ldapUserSchoolAssociation = Ldap.Attr "LMU-IFI-eduPersonOrgUnitDNString"
ldapSex = Ldap.Attr "schacGender" ldapSex = Ldap.Attr "schacGender"
ldapUserEmail :: [Ldap.Attr] ldapUserEmail :: NonEmpty Ldap.Attr
ldapUserEmail = ldapUserEmail = Ldap.Attr "mail" :|
[ Ldap.Attr "mail" [ Ldap.Attr "name"
, Ldap.Attr "name"
] ]

View File

@ -3366,7 +3366,7 @@ upsertCampusUser ldapData Creds{..} = do
let let
userMatrikelnummer' = fold [ v | (k, v) <- ldapData, k == ldapUserMatriculation ] userMatrikelnummer' = fold [ v | (k, v) <- ldapData, k == ldapUserMatriculation ]
userEmail' = fold [ v | (k, v) <- ldapData, k' <- ldapUserEmail, k' == k ] userEmail' = fold [ v | (k, v) <- ldapData, k' <- toList ldapUserEmail, k' == k ]
userDisplayName'' = fold [ v | (k, v) <- ldapData, k == ldapUserDisplayName ] userDisplayName'' = fold [ v | (k, v) <- ldapData, k == ldapUserDisplayName ]
userFirstName' = fold [ v | (k, v) <- ldapData, k == ldapUserFirstName ] userFirstName' = fold [ v | (k, v) <- ldapData, k == ldapUserFirstName ]
userSurname' = fold [ v | (k, v) <- ldapData, k == ldapUserSurname ] userSurname' = fold [ v | (k, v) <- ldapData, k == ldapUserSurname ]