diff options
author | Marian Sigler <m@qjym.de> | 2012-09-21 06:07:55 +0200 |
---|---|---|
committer | Marian Sigler <m@qjym.de> | 2012-09-21 06:07:55 +0200 |
commit | ef5bf83da44a7e14b0cbe4733a19b2933e77671c (patch) | |
tree | b0a5c338c2f841ebd85691be918bdb3dab608b61 | |
parent | 162a4fdce512e86d64436bb38d4128993f322138 (diff) | |
download | web-ef5bf83da44a7e14b0cbe4733a19b2933e77671c.tar.gz web-ef5bf83da44a7e14b0cbe4733a19b2933e77671c.tar.bz2 web-ef5bf83da44a7e14b0cbe4733a19b2933e77671c.zip |
account: remove delete by string for the time being
That functionality requires searching through the subtree for services
to be deleted etc.
-rw-r--r-- | account.py | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -108,7 +108,7 @@ class AccountService: dn = 'uid=%s,ou=users,%s' % (account.uid, self.base_dn) attr = [ - ('objectClass', ['top','inetOrgPerson']), ('uid',account.uid), + ('objectClass', ['top','inetOrgPerson']), ('uid', account.uid), ('sn', ' '), ('cn', ' '), ('mail', account.mail), ('userPassword', account.password) ] @@ -139,20 +139,20 @@ class AccountService: self._unbind() - def delete(self, account, admin_user = None, admin_pass = None): + def delete(self, account, password=None, as_admin=False): """ Deletes an account permanently. """ + if isinstance(account, basestring): + raise NotImplementedError() + else: + user = account.dn + password = account.password + if as_admin: self._bind_as_admin() else: - if isinstance(account, basestring): - user = 'uid=%s,ou=users,%s' % (account, self.base_dn) - else: - user = account.dn - - password = account.password self._bind('%s,%s' % (user, self.base_dn), password) dn = ['uid=%s,cn=%s,ou=services,%s' % (account.uid,s,self.base_dn) for s in account.services] @@ -169,7 +169,7 @@ class AccountService: self.connection.simple_bind_s(dn, password) - def _bind_as_admin(): + def _bind_as_admin(self): self._bind('cn=%s,%s' % (self.admin_user, self.base_dn), self.admin_pass) @@ -204,11 +204,11 @@ class Account: For each service a spline user can have a different password. """ def __init__(self, uid, mail, services = [], dn = None, password = None): - self.uid = uid - self.mail = mail + self.uid = uid.encode('utf8') if isinstance(uid, unicode) else uid + self.mail = mail.encode('utf8') if isinstance(mail, unicode) else mail self.services = services self.dn = dn - self.password = password + self.password = password.encode('utf8') if isinstance(password, unicode) else password self.new_password_root = None self.new_password_services = {} |