equal
deleted
inserted
replaced
209 return self._transport.getID() |
209 return self._transport.getID() |
210 |
210 |
211 def getInfo(self): |
211 def getInfo(self): |
212 """Returns a dictionary with information about the domain.""" |
212 """Returns a dictionary with information about the domain.""" |
213 sql = """\ |
213 sql = """\ |
214 SELECT gid, domainname, transport, domaindir, aliasdomains, accounts, aliases |
214 SELECT gid, domainname, transport, domaindir, aliasdomains, accounts, |
|
215 aliases, relocated |
215 FROM vmm_domain_info |
216 FROM vmm_domain_info |
216 WHERE gid = %i""" % self._id |
217 WHERE gid = %i""" % self._id |
217 dbc = self._dbh.cursor() |
218 dbc = self._dbh.cursor() |
218 dbc.execute(sql) |
219 dbc.execute(sql) |
219 info = dbc.fetchone() |
220 info = dbc.fetchone() |
221 if info is None: |
222 if info is None: |
222 raise VMMDE(_(u"The domain »%s« doesn't exist yet.") % self._name, |
223 raise VMMDE(_(u"The domain »%s« doesn't exist yet.") % self._name, |
223 ERR.NO_SUCH_DOMAIN) |
224 ERR.NO_SUCH_DOMAIN) |
224 else: |
225 else: |
225 keys = ['gid', 'domainname', 'transport', 'domaindir', |
226 keys = ['gid', 'domainname', 'transport', 'domaindir', |
226 'aliasdomains', 'accounts', 'aliases'] |
227 'aliasdomains', 'accounts', 'aliases', 'relocated'] |
227 return dict(zip(keys, info)) |
228 return dict(zip(keys, info)) |
228 |
229 |
229 def getAccounts(self): |
230 def getAccounts(self): |
230 """Returns a list with all accounts from the domain.""" |
231 """Returns a list with all accounts from the domain.""" |
231 dbc = self._dbh.cursor() |
232 dbc = self._dbh.cursor() |
249 aliases = [] |
250 aliases = [] |
250 if len(addresses) > 0: |
251 if len(addresses) > 0: |
251 for alias in addresses: |
252 for alias in addresses: |
252 aliases.append('%s@%s' % (alias[0], self._name)) |
253 aliases.append('%s@%s' % (alias[0], self._name)) |
253 return aliases |
254 return aliases |
|
255 |
|
256 def getRelocated(self): |
|
257 """Returns a list with all addresses from relocated users.""" |
|
258 dbc = self._dbh.cursor() |
|
259 dbc.execute("SELECT address FROM relocated WHERE gid = %s\ |
|
260 ORDER BY address", self._id) |
|
261 addresses = dbc.fetchall() |
|
262 dbc.close() |
|
263 relocated = [] |
|
264 if len(addresses) > 0: |
|
265 for address in addresses: |
|
266 relocated.append('%s@%s' % (address[0], self._name)) |
|
267 return relocated |
254 |
268 |
255 def getAliaseNames(self): |
269 def getAliaseNames(self): |
256 """Returns a list with all alias names from the domain.""" |
270 """Returns a list with all alias names from the domain.""" |
257 dbc = self._dbh.cursor() |
271 dbc = self._dbh.cursor() |
258 dbc.execute("SELECT domainname FROM domain_name WHERE gid = %s\ |
272 dbc.execute("SELECT domainname FROM domain_name WHERE gid = %s\ |