diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-02 18:02:36 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-02 18:02:36 +0100 |
commit | 5566d26d9cb4f992e974ad8a8720c5970d566105 (patch) | |
tree | 78a20c70e3abb2e465d09d4a4ef03f3281014583 /virtual/packages | |
parent | 940f18341ee8f1e86a18a3488c41b5bbef909cd1 (diff) | |
download | Nix-5566d26d9cb4f992e974ad8a8720c5970d566105.tar.gz Nix-5566d26d9cb4f992e974ad8a8720c5970d566105.tar.zst Nix-5566d26d9cb4f992e974ad8a8720c5970d566105.zip |
Add gitolite
Diffstat (limited to 'virtual/packages')
-rwxr-xr-x | virtual/packages/gitolite_ldap_groups.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/virtual/packages/gitolite_ldap_groups.sh b/virtual/packages/gitolite_ldap_groups.sh new file mode 100755 index 0000000..5f7ef6d --- /dev/null +++ b/virtual/packages/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} -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" | ||