summaryrefslogtreecommitdiffstats
path: root/account.py
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-28 01:32:27 +0200
committerMarian Sigler <m@qjym.de>2012-09-28 01:32:27 +0200
commit84546333cae64f9ea0765e3cc36f1f92674a1a08 (patch)
treea2a283aab2fd01e2dc0215471b4d8ed5456216b9 /account.py
parent0722c5e49e29ad6eab2d23f0e8f3d59efb52bd2e (diff)
downloadweb-84546333cae64f9ea0765e3cc36f1f92674a1a08.tar.gz
web-84546333cae64f9ea0765e3cc36f1f92674a1a08.tar.bz2
web-84546333cae64f9ea0765e3cc36f1f92674a1a08.zip
create servicePassword ldap object if it does not already exist
Diffstat (limited to 'account.py')
-rw-r--r--account.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/account.py b/account.py
index 1361669..f25e170 100644
--- a/account.py
+++ b/account.py
@@ -84,7 +84,7 @@ class AccountService:
dn = self._format_dn([('ou', 'services')])
filterstr = '(uid=%s)' % self._escape(uid)
- data_service = self.connection.search_s(dn,ldap.SCOPE_SUBTREE,filterstr)
+ data_service = self.connection.search_s(dn, ldap.SCOPE_SUBTREE, filterstr)
services = []
for entry in data_service:
@@ -269,6 +269,11 @@ class AccountService:
for service, passwords in account.new_password_services.items():
dn = self._format_dn([('uid',account.uid),('cn',service),('ou','services')])
+
+ if service not in account.services:
+ attr = [('objectClass', ['top', 'servicePassword']), ('uid', account.uid)]
+ self.connection.add_s(dn, attr)
+
old, new = passwords
if as_admin:
self.connection.passwd_s(dn, None, new)