This function uses ldapsearch to query the KTH Active Directory. It requires environment variables to be set in .Renviron, specifically LDAP_USER, LDAP_PASS, LDAP_HOST and LDAP_BASE for the service account used for the queries.
ldap_search(ldap_query, ldap_attributes = NULL, cfg = ldap_config())
the LDAP query to issue, such as 'ugKthid=*'
set of attributes to return, by default NULL but can be a character vector of attributes, such as c('ugKthid', 'ugOrcid')
the connection credentials, by default given from ldap_config()
tibble with results
The ldapsearch command makes use of -E pr=2147483647/noprompt to avoid paging and returns results in LDIF format which is parsed into a tibble.
It is possible to disable ldaps TLS require certificate check, by setting the environment variable LDAPTLS_REQCERT to "never" (can be done in .Renviron)
if (FALSE) {
if(interactive()){
ldap_search("(&(ugOrcid=*)(ugKthid=*))", c("ugKthid", "ugOrcid"))
}
}