Browse Source

Oops, forgot a file

Théo Ertzscheid 2 years ago
parent
commit
291951dc83
1 changed files with 13 additions and 0 deletions
  1. 13 0
      funcs

+ 13 - 0
funcs

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+. .env
+
+user_exists() {
+	res=$(ldapsearch -x -LLL -b $PEOPLEDN -D $BINDDN -w $BINDPW "(&(uid=$1)(objectClass=inetOrgPerson))" | grep uid: | cut -f2 -d' ')
+	[ -n "$res" ]
+}
+
+group_exists() {
+	res=$(ldapsearch -x -LLL -b $GROUPSDN -D $BINDDN -w $BINDPW "(&(cn=$1)(objectClass=groupOfNames))" | grep cn: | cut -f2 -d' ')
+	[ -n "$res" ]
+}