fix: fallback for determining user email
This commit is contained in:
parent
cb88fffcad
commit
6a1a256cc2
@ -59,9 +59,8 @@ findUser LdapConf{..} ldap ident retAttrs = fromMaybe [] <$> findM (assertM (not
|
|||||||
, Ldap.derefAliases Ldap.DerefAlways
|
, Ldap.derefAliases Ldap.DerefAlways
|
||||||
]
|
]
|
||||||
|
|
||||||
ldapUserPrincipalName, ldapUserEmail, ldapUserDisplayName, ldapUserMatriculation, ldapUserFirstName, ldapUserSurname, ldapUserTitle, ldapUserStudyFeatures, ldapUserFieldName, ldapUserSchoolAssociation, ldapSex :: Ldap.Attr
|
ldapUserPrincipalName, ldapUserDisplayName, ldapUserMatriculation, ldapUserFirstName, ldapUserSurname, ldapUserTitle, ldapUserStudyFeatures, ldapUserFieldName, ldapUserSchoolAssociation, ldapSex :: Ldap.Attr
|
||||||
ldapUserPrincipalName = Ldap.Attr "userPrincipalName"
|
ldapUserPrincipalName = Ldap.Attr "userPrincipalName"
|
||||||
ldapUserEmail = Ldap.Attr "mail"
|
|
||||||
ldapUserDisplayName = Ldap.Attr "displayName"
|
ldapUserDisplayName = Ldap.Attr "displayName"
|
||||||
ldapUserMatriculation = Ldap.Attr "LMU-Stud-Matrikelnummer"
|
ldapUserMatriculation = Ldap.Attr "LMU-Stud-Matrikelnummer"
|
||||||
ldapUserFirstName = Ldap.Attr "givenName"
|
ldapUserFirstName = Ldap.Attr "givenName"
|
||||||
@ -72,6 +71,12 @@ 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 =
|
||||||
|
[ Ldap.Attr "mail"
|
||||||
|
, Ldap.Attr "name"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
data CampusUserException = CampusUserLdapError LdapPoolError
|
data CampusUserException = CampusUserLdapError LdapPoolError
|
||||||
| CampusUserHostNotResolved String
|
| CampusUserHostNotResolved String
|
||||||
|
|||||||
@ -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 ]
|
userEmail' = fold [ v | (k, v) <- ldapData, k' <- 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 ]
|
||||||
@ -3379,7 +3379,7 @@ upsertCampusUser ldapData Creds{..} = do
|
|||||||
userLastAuthentication = now <$ guard (not isDummy)
|
userLastAuthentication = now <$ guard (not isDummy)
|
||||||
|
|
||||||
userEmail <- if
|
userEmail <- if
|
||||||
| [bs] <- userEmail'
|
| bs : _ <- userEmail'
|
||||||
, Right userEmail <- Text.decodeUtf8' bs
|
, Right userEmail <- Text.decodeUtf8' bs
|
||||||
-> return $ mk userEmail
|
-> return $ mk userEmail
|
||||||
| otherwise
|
| otherwise
|
||||||
|
|||||||
Reference in New Issue
Block a user