ldap_search: Search Active Directory at KTH

View source: R/ldap.R

ldap_searchR Documentation

Search Active Directory at KTH

Description

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.

Usage

ldap_search(ldap_query, ldap_attributes = NULL, cfg = ldap_config())

Arguments

ldap_query

the LDAP query to issue, such as 'ugKthid=*'

ldap_attributes

set of attributes to return, by default NULL but can be a character vector of attributes, such as c('ugKthid', 'ugOrcid')

cfg

the connection credentials, by default given from ldap_config()

Details

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)

Value

tibble with results

Examples

## Not run: 
if(interactive()){
 ldap_search("(&(ugOrcid=*)(ugKthid=*))", c("ugKthid", "ugOrcid"))
 }

## End(Not run)

KTH-Library/kthapi documentation built on June 27, 2023, 9:27 p.m.