diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-13 21:25:24 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-24 01:40:13 +0200 |
commit | 252dd7d899b7a0deea1537cc5d2d48b825afffb0 (patch) | |
tree | f51c3c9cd7429b0b9553a840f26bee489be045bc /modules/private/gitolite/gitolite_ldap_groups.sh | |
download | NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.tar.gz NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.tar.zst NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.zip |
Initial commit published for NURnur_root
Diffstat (limited to 'modules/private/gitolite/gitolite_ldap_groups.sh')
-rwxr-xr-x | modules/private/gitolite/gitolite_ldap_groups.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/private/gitolite/gitolite_ldap_groups.sh b/modules/private/gitolite/gitolite_ldap_groups.sh new file mode 100755 index 00000000..7db0da40 --- /dev/null +++ b/modules/private/gitolite/gitolite_ldap_groups.sh | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | uid_param="$1" | ||
4 | ldap_host="ldap.immae.eu" | ||
5 | ldap_binddn="cn=gitolite,ou=services,dc=immae,dc=eu" | ||
6 | ldap_bindpw="$LDAP_PASS" | ||
7 | ldap_searchbase="dc=immae,dc=eu" | ||
8 | ldap_scope="subtree" | ||
9 | |||
10 | ldap_options="-h ${ldap_host} -ZZ -x -D ${ldap_binddn} -w ${ldap_bindpw} -b ${ldap_searchbase} -s ${ldap_scope}" | ||
11 | |||
12 | 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)))" | ||
13 | ldap_result=$(ldapsearch ${ldap_options} -LLL "${ldap_filter}" cn | grep 'cn:' | cut -d' ' -f2) | ||
14 | |||
15 | echo "$ldap_result" | ||