fixed up several broken URLs (minor but annoying)
[gitolite.git] / contrib / utils / ldap_groups.sh
blobbeec5114b8b2a2d05fed9966b8ea1d2f71540139
1 #!/bin/bash
3 # author: damien.nozay@gmail.com
5 # Given a username,
6 # Provides a space-separated list of groups that the user is a member of.
8 # see http://gitolite.com/gitolite/conf.html#getting-user-group-info-from-ldap
9 # GROUPLIST_PGM => /path/to/ldap_groups.sh
11 ldap_groups() {
12 username=$1;
13 # this relies on openldap / pam_ldap to be configured properly on your
14 # system. my system allows anonymous search.
15 echo $(
16 ldapsearch -x -LLL "(&(objectClass=posixGroup)(memberUid=${username}))" cn \
17 | grep "^cn" \
18 | cut -d' ' -f2
22 ldap_groups $@