624 if destination.gid and \ |
624 if destination.gid and \ |
625 not self._chk_other_address_types(destination, TYPE_RELOCATED): |
625 not self._chk_other_address_types(destination, TYPE_RELOCATED): |
626 self._warnings.append(_("The destination account/alias '%s' " |
626 self._warnings.append(_("The destination account/alias '%s' " |
627 "does not exist.") % destination) |
627 "does not exist.") % destination) |
628 |
628 |
629 def user_delete(self, emailaddress, delete_home, force=False): |
629 def user_delete(self, emailaddress, del_dir, force=False): |
630 """Wrapper around Account.delete(...)""" |
630 """Wrapper around Account.delete(...)""" |
631 if not isinstance(delete_home, bool): |
631 if not isinstance(del_dir, bool): |
632 raise TypeError('delete_home must be a bool') |
632 raise TypeError('del_dir must be a bool') |
633 if not isinstance(force, bool): |
633 if not isinstance(force, bool): |
634 raise TypeError('force must be a bool') |
634 raise TypeError('force must be a bool') |
635 acc = self._get_account(emailaddress) |
635 acc = self._get_account(emailaddress) |
636 if not acc: |
636 if not acc: |
637 raise VMMError(_("The account '%s' does not exist.") % |
637 raise VMMError(_("The account '%s' does not exist.") % |
639 uid = acc.uid |
639 uid = acc.uid |
640 gid = acc.gid |
640 gid = acc.gid |
641 dom_dir = acc.domain.directory |
641 dom_dir = acc.domain.directory |
642 acc_dir = acc.home |
642 acc_dir = acc.home |
643 acc.delete(force) |
643 acc.delete(force) |
644 if delete_home or self._cfg.dget('account.delete_directory'): |
644 if del_dir or self._cfg.dget('account.delete_directory'): |
645 try: |
645 try: |
646 self._delete_home(dom_dir, uid, gid) |
646 self._delete_home(dom_dir, uid, gid) |
647 except VMMError as err: |
647 except VMMError as err: |
648 if err.code in (FOUND_DOTS_IN_PATH, MAILDIR_PERM_MISMATCH, |
648 if err.code in (FOUND_DOTS_IN_PATH, MAILDIR_PERM_MISMATCH, |
649 NO_SUCH_DIRECTORY): |
649 NO_SUCH_DIRECTORY): |