blob: 5f7ef6de1f8abd2549bf48f7f39460e6a86ebd05 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/usr/bin/env bash
uid_param="$1"
ldap_host="ldap.immae.eu"
ldap_binddn="cn=gitolite,ou=services,dc=immae,dc=eu"
ldap_bindpw="$LDAP_PASS"
ldap_searchbase="dc=immae,dc=eu"
ldap_scope="subtree"
ldap_options="-h ${ldap_host} -x -D ${ldap_binddn} -w ${ldap_bindpw} -b ${ldap_searchbase} -s ${ldap_scope}"
ldap_filter="(&(memberOf=cn=groups,cn=gitolite,ou=services,dc=immae,dc=eu)(|(member=uid=${uid_param},ou=users,dc=immae,dc=eu)(member=uid=${uid_param},ou=group_users,dc=immae,dc=eu)))"
ldap_result=$(ldapsearch ${ldap_options} -LLL "${ldap_filter}" cn | grep 'cn:' | cut -d' ' -f2)
echo "$ldap_result"
|