summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-03-31 12:38:12 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-03-31 12:38:12 (GMT)
commit91f8ccbeff05de194fe508c239f6240ee1008516 (patch)
tree4840e27b3e989804e307abc3f466e0d4f647a110
parenta56fda0858769910fd89ebdb546df80b8a156508 (diff)
downloadpfwbged.ocrloader-91f8ccbeff05de194fe508c239f6240ee1008516.zip
pfwbged.ocrloader-91f8ccbeff05de194fe508c239f6240ee1008516.tar.gz
pfwbged.ocrloader-91f8ccbeff05de194fe508c239f6240ee1008516.tar.bz2
revise default entries (#4583)
-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