chore(ldap): ldapSearch for arbitrary number of results
This commit is contained in:
parent
78a8442d07
commit
8c4ec00c35
@ -20,6 +20,7 @@ module Auth.LDAP
|
|||||||
, ldapUserMobile, ldapUserTelephone
|
, ldapUserMobile, ldapUserTelephone
|
||||||
, ldapUserFraportPersonalnummer, ldapUserFraportAbteilung
|
, ldapUserFraportPersonalnummer, ldapUserFraportAbteilung
|
||||||
, ldapUserTitle
|
, ldapUserTitle
|
||||||
|
, ldapSearch
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import.NoFoundation
|
import Import.NoFoundation
|
||||||
@ -96,6 +97,17 @@ userSearchSettings LdapConf{..} = mconcat
|
|||||||
, Ldap.derefAliases Ldap.DerefAlways
|
, Ldap.derefAliases Ldap.DerefAlways
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ldapSearch :: forall m.
|
||||||
|
( MonadUnliftIO m
|
||||||
|
, MonadCatch m
|
||||||
|
)
|
||||||
|
=> (LdapConf, LdapPool)
|
||||||
|
-> Text -- ^ needle
|
||||||
|
-> m [Ldap.SearchEntry]
|
||||||
|
ldapSearch (conf@LdapConf{..}, ldapPool) needle = either (throwM . LdapUserLdapError) return <=< withLdap ldapPool $ \ldap -> liftIO $ do
|
||||||
|
Ldap.bind ldap ldapConfDn ldapConfPassword
|
||||||
|
findUser conf ldap needle []
|
||||||
|
|
||||||
ldapPrimaryKey, ldapUserPrincipalName, ldapUserDisplayName, ldapUserFirstName, ldapUserSurname, ldapAffiliation, ldapUserTitle, ldapUserTelephone, ldapUserMobile, ldapUserFraportPersonalnummer, ldapUserFraportAbteilung :: Ldap.Attr
|
ldapPrimaryKey, ldapUserPrincipalName, ldapUserDisplayName, ldapUserFirstName, ldapUserSurname, ldapAffiliation, ldapUserTitle, ldapUserTelephone, ldapUserMobile, ldapUserFraportPersonalnummer, ldapUserFraportAbteilung :: Ldap.Attr
|
||||||
ldapPrimaryKey = Ldap.Attr "cn" -- should always be identical to "sAMAccountName"
|
ldapPrimaryKey = Ldap.Attr "cn" -- should always be identical to "sAMAccountName"
|
||||||
ldapUserPrincipalName = Ldap.Attr "userPrincipalName"
|
ldapUserPrincipalName = Ldap.Attr "userPrincipalName"
|
||||||
|
|||||||
Reference in New Issue
Block a user