diff options
author | Marian Sigler <m@qjym.de> | 2012-09-28 01:32:27 +0200 |
---|---|---|
committer | Marian Sigler <m@qjym.de> | 2012-09-28 01:32:27 +0200 |
commit | 84546333cae64f9ea0765e3cc36f1f92674a1a08 (patch) | |
tree | a2a283aab2fd01e2dc0215471b4d8ed5456216b9 /account.py | |
parent | 0722c5e49e29ad6eab2d23f0e8f3d59efb52bd2e (diff) | |
download | web-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.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |