VirtualMailManager/Domain.py
changeset 24 48ea255e8a85
parent 18 c98e08791ee8
child 32 ceb700bc4a80
equal deleted inserted replaced
23:d5ad5432e9eb 24:48ea255e8a85
   212             return dict(zip(keys, info))
   212             return dict(zip(keys, info))
   213 
   213 
   214     def getAccounts(self):
   214     def getAccounts(self):
   215         """Returns a list with all accounts from the domain."""
   215         """Returns a list with all accounts from the domain."""
   216         dbc = self._dbh.cursor()
   216         dbc = self._dbh.cursor()
   217         dbc.execute("SELECT userid AS users FROM dovecot_user WHERE gid = %s",
   217         dbc.execute("SELECT userid AS users FROM dovecot_user WHERE gid = %s\
       
   218  ORDER BY users",
   218                 self._id)
   219                 self._id)
   219         users = dbc.fetchall()
   220         users = dbc.fetchall()
   220         dbc.close()
   221         dbc.close()
   221         accounts = []
   222         accounts = []
   222         if len(users) > 0:
   223         if len(users) > 0:
   225         return accounts
   226         return accounts
   226 
   227 
   227     def getAliases(self):
   228     def getAliases(self):
   228         """Returns a list with all aliases from the domain."""
   229         """Returns a list with all aliases from the domain."""
   229         dbc = self._dbh.cursor()
   230         dbc = self._dbh.cursor()
   230         dbc.execute("SELECT DISTINCT address FROM postfix_alias WHERE gid=%s",
   231         dbc.execute("SELECT DISTINCT address FROM postfix_alias WHERE gid=%s\
       
   232  ORDER BY address",
   231                 self._id)
   233                 self._id)
   232         addresses = dbc.fetchall()
   234         addresses = dbc.fetchall()
   233         dbc.close()
   235         dbc.close()
   234         aliases = []
   236         aliases = []
   235         if len(addresses) > 0:
   237         if len(addresses) > 0: