This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
curie/export-ldap2psl

20 lines
804 B
Bash
Executable File

#!/bin/sh
CREDENTIALS=${CREDENTIALS:--Y EXTERNAL -H ldapi://}
set -e
TMP=`tempfile`
LOG=`tempfile`
trap "rm $TMP $LOG" EXIT
if ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s base -b dc=curie,dc=fr '' objectClass dc supannEtablissement o >$TMP 2>$LOG && \
ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s base -b ou=people,dc=curie,dc=fr '' objectClass ou >>$TMP 2>$LOG && \
ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s one -b ou=people,dc=curie,dc=fr '' objectClass cn uid sn givenName supannEtablissement mail telephoneNumber supannListRouge eduPersonAffiliation eduPersonPrimaryAffiliation >>$TMP 2>$LOG; then
echo 'version: 1'
cat $TMP | sed '/^version: 1/d' | sed '/^objectClass: icPerson/d'
exit 0
fi
echo Une erreur est survenue
cat $LOG
exit 1