summaryrefslogtreecommitdiff
path: root/hosted-kolab/09-add-doe-at-mgmt-domain-admin.sh
diff options
context:
space:
mode:
Diffstat (limited to 'hosted-kolab/09-add-doe-at-mgmt-domain-admin.sh')
-rwxr-xr-xhosted-kolab/09-add-doe-at-mgmt-domain-admin.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/hosted-kolab/09-add-doe-at-mgmt-domain-admin.sh b/hosted-kolab/09-add-doe-at-mgmt-domain-admin.sh
new file mode 100755
index 0000000..298d776
--- /dev/null
+++ b/hosted-kolab/09-add-doe-at-mgmt-domain-admin.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. ./settings.sh
+
+(
+ echo "dn: uid=doe@${domain},ou=People,${rootdn}"
+ echo "objectClass: top"
+ echo "objectClass: inetorgperson"
+ echo "objectClass: kolabinetorgperson"
+ echo "objectClass: organizationalperson"
+ echo "objectClass: person"
+ echo "givenName: John"
+ echo "sn: Doe"
+ echo "cn: John Doe"
+ echo "mail: doe@${domain}"
+ echo "uid: doe@${domain}"
+ echo "nsroledn: cn=admin-user,${rootdn}"
+ echo "userPassword: ${default_user_password}"
+ echo ""
+) | ldapadd -x -h ${ldap_host} -D "${ldap_binddn}" -w "${ldap_bindpw}"
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=doe@${domain},ou=People,${rootdn}" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(&(objectclass=domainrelatedobject)(associateddomain=${domain}))" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne 1 ]; then
+ echo "ERROR: Expected 1 domain, got ${num_domains} domains"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=doe@${domain},ou=People,${rootdn}" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL '(objectclass=domainrelatedobject)' dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -lt 3 ]; then
+ echo "ERROR: Expected more than 3 domains, got ${num_domains} domain(s)"
+fi
+