summaryrefslogtreecommitdiffstats
path: root/debian/tests/create_account
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests/create_account')
-rwxr-xr-xdebian/tests/create_account24
1 files changed, 24 insertions, 0 deletions
diff --git a/debian/tests/create_account b/debian/tests/create_account
new file mode 100755
index 0000000..a5051af
--- /dev/null
+++ b/debian/tests/create_account
@@ -0,0 +1,24 @@
+#! /usr/bin/perl -w
+
+# Shows how to create an entry on the LDAP server
+
+$host = "localhost"; # LDAP server
+$basedn = "dc=galaxy"; # Base DN
+$admindn = "cn=admin, $basedn"; # Admin entry
+$adminpass = "foo"; # Password
+
+use Net::LDAP;
+
+$ldap = Net::LDAP->new("$host", onerror => "die");
+$ldap->bind($admindn, password => $adminpass);
+
+# Create "ou=People" entry if not there
+
+$results = $ldap->search(base => "$basedn",
+ filter => "ou=People", scope => "one");
+unless ($results->count > 0) {
+ $ldap->add("ou=People, $basedn", attr => [
+ ou => "People",
+ objectClass => [ "top", "organizationalUnit" ]
+ ]);
+}