501 self.__domDirDelete(domdir, gid) |
501 self.__domDirDelete(domdir, gid) |
502 |
502 |
503 def domainInfo(self, domainname, details=None): |
503 def domainInfo(self, domainname, details=None): |
504 if details not in [None, 'accounts', 'aliasdomains', 'aliases', 'full', |
504 if details not in [None, 'accounts', 'aliasdomains', 'aliases', 'full', |
505 'relocated', 'detailed']: |
505 'relocated', 'detailed']: |
506 raise VMMDomainException(_(u'Invalid argument: »%s«') % details, |
506 raise VMMException(_(u'Invalid argument: »%s«') % details, |
507 ERR.INVALID_OPTION) |
507 ERR.INVALID_AGUMENT) |
508 if details == 'detailed': |
508 if details == 'detailed': |
509 details = 'full' |
509 details = 'full' |
510 warning = _(u"""\ |
510 warning = _(u"""\ |
511 The keyword »detailed« is deprecated and will be removed in a future release. |
511 The keyword »detailed« is deprecated and will be removed in a future release. |
512 Please use the keyword »full« to get full details.""") |
512 Please use the keyword »full« to get full details.""") |
514 dom = self.__getDomain(domainname) |
514 dom = self.__getDomain(domainname) |
515 dominfo = dom.getInfo() |
515 dominfo = dom.getInfo() |
516 if dominfo['domainname'].startswith('xn--'): |
516 if dominfo['domainname'].startswith('xn--'): |
517 dominfo['domainname'] += ' (%s)'\ |
517 dominfo['domainname'] += ' (%s)'\ |
518 % VirtualMailManager.ace2idna(dominfo['domainname']) |
518 % VirtualMailManager.ace2idna(dominfo['domainname']) |
519 if dominfo['aliases'] is None: |
|
520 dominfo['aliases'] = 0 |
|
521 if details is None: |
519 if details is None: |
522 return dominfo |
520 return dominfo |
523 elif details == 'accounts': |
521 elif details == 'accounts': |
524 return (dominfo, dom.getAccounts()) |
522 return (dominfo, dom.getAccounts()) |
525 elif details == 'aliasdomains': |
523 elif details == 'aliasdomains': |
640 |
638 |
641 def aliasDelete(self, aliasaddress, targetaddress=None): |
639 def aliasDelete(self, aliasaddress, targetaddress=None): |
642 alias = self.__getAlias(aliasaddress, targetaddress) |
640 alias = self.__getAlias(aliasaddress, targetaddress) |
643 alias.delete() |
641 alias.delete() |
644 |
642 |
645 def userInfo(self, emailaddress, diskusage=False): |
643 def userInfo(self, emailaddress, details=None): |
|
644 if details not in [None, 'du', 'aliases', 'full']: |
|
645 raise VMMException(_(u'Invalid argument: »%s«') % details, |
|
646 ERR.INVALID_AGUMENT) |
646 acc = self.__getAccount(emailaddress) |
647 acc = self.__getAccount(emailaddress) |
647 info = acc.getInfo() |
648 info = acc.getInfo() |
648 if self.__Cfg.getboolean('maildir', 'diskusage') or diskusage: |
649 if self.__Cfg.getboolean('maildir', 'diskusage')\ |
|
650 or details in ['du', 'full']: |
649 info['disk usage'] = self.__getDiskUsage('%(maildir)s' % info) |
651 info['disk usage'] = self.__getDiskUsage('%(maildir)s' % info) |
|
652 if details in [None, 'du']: |
|
653 return info |
|
654 if details in ['aliases', 'full']: |
|
655 return (info, acc.getAliases()) |
650 return info |
656 return info |
651 |
657 |
652 def userByID(self, uid): |
658 def userByID(self, uid): |
653 from Account import getAccountByID |
659 from Account import getAccountByID |
654 self.__dbConnect() |
660 self.__dbConnect() |