diff --git a/src/Auth/LDAP.hs b/src/Auth/LDAP.hs index 0e2ad5173..7863ec34a 100644 --- a/src/Auth/LDAP.hs +++ b/src/Auth/LDAP.hs @@ -47,10 +47,12 @@ findUser LdapConf{..} ldap ident retAttrs = fromMaybe [] <$> findM (assertM (not userFilters = [ ldapUserPrincipalName Ldap.:= Text.encodeUtf8 ident , 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 [st|#{ident}@campus.lmu.de|] - , ldapUserDisplayName Ldap.:= Text.encodeUtf8 ident + ] ++ + [ ldapUserEmail' Ldap.:= Text.encodeUtf8 ident' + | ident' <- [ident, [st|#{ident}@lmu.de|], [st|#{ident}@campus.lmu.de|]] + , ldapUserEmail' <- toList ldapUserEmail + ] ++ + [ ldapUserDisplayName Ldap.:= Text.encodeUtf8 ident ] userSearchSettings = mconcat [ Ldap.scope ldapScope @@ -71,10 +73,9 @@ ldapUserFieldName = Ldap.Attr "dfnEduPersonFieldOfStudyString" ldapUserSchoolAssociation = Ldap.Attr "LMU-IFI-eduPersonOrgUnitDNString" ldapSex = Ldap.Attr "schacGender" -ldapUserEmail :: [Ldap.Attr] -ldapUserEmail = - [ Ldap.Attr "mail" - , Ldap.Attr "name" +ldapUserEmail :: NonEmpty Ldap.Attr +ldapUserEmail = Ldap.Attr "mail" :| + [ Ldap.Attr "name" ] diff --git a/src/Foundation.hs b/src/Foundation.hs index e8243aa0d..83fc689f4 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -3366,7 +3366,7 @@ upsertCampusUser ldapData Creds{..} = do let 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 ] userFirstName' = fold [ v | (k, v) <- ldapData, k == ldapUserFirstName ] userSurname' = fold [ v | (k, v) <- ldapData, k == ldapUserSurname ]