summaryrefslogtreecommitdiffstats
path: root/generate-ldap-users.py
diff options
context:
space:
mode:
Diffstat (limited to 'generate-ldap-users.py')
-rw-r--r--generate-ldap-users.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/generate-ldap-users.py b/generate-ldap-users.py
index 208d124..b52d88b 100644
--- a/generate-ldap-users.py
+++ b/generate-ldap-users.py
@@ -22,7 +22,7 @@ cfg.read(options.config)
ldap_conn = ldap.initialize(cfg.get('general', 'ldap_uri'))
ldap_conn.simple_bind_s(cfg.get('general', 'bind_dn'), options.bindpw)
-usernames = []
+users = []
for entry in ldap_conn.search_s("dc=win,dc=info,dc=pcf", ldap.SCOPE_SUBTREE, "objectclass=user"):
if not entry[0]:
@@ -32,26 +32,30 @@ for entry in ldap_conn.search_s("dc=win,dc=info,dc=pcf", ldap.SCOPE_SUBTREE, "ob
try:
username = entry[1]['sAMAccountName'][0]
+ mail = entry[1]['mail'][0]
except KeyError:
continue
- usernames.append(username)
+ users.append[{'username': username, 'mail': mail}]
fd = file(options.output_filename, 'w')
print >> fd, file(cfg.get('general', 'template')).read()
-for username in usernames:
- vars = {'username': username, 'username_lower': username.lower()}
+for user in users:
+ vars = {'username': user.get('username'),
+ 'username_lower': user.get('username').lower(),
+ 'mail': user.get('mail'),
+ }
vars.update(dict(cfg.items('variables')))
print username
- print >> fd, '''[ged-%(username_lower)s@pfwb.be]
+ print >> fd, '''[ged-gen-%(mail)s]
default_type = dmsdocument
default_directory = Members/%(username)s
user = %(username)s
-[ged-file-%(username)s@pfwb.be]
+[ged-%(mail)s]
store_path = /srv/ocr/%(username)s
-[ged-test-%(username_lower)s@pfwb.be]
+[ged-test-gen-%(mail)s]
ged_base_url = %(test_server_url)s
default_type = dmsdocument
default_directory = Members/%(username)s