Commit 680191d7 authored by Joshua Tauberer's avatar Joshua Tauberer

drop the list of aliases from the users control panel page because with more...

drop the list of aliases from the users control panel page because with more than 50 aliases it seems to be so slow it times out

see https://discourse.mailinabox.email/t/small-bug-in-admin-panel-when-49-aliases/378
parent 81d6d69b
...@@ -19,6 +19,7 @@ Control panel: ...@@ -19,6 +19,7 @@ Control panel:
* The new check that system services are running mistakenly checked that the Dovecot Managesieve service is publicly accessible. Although the service binds to the public network interface we don't open the port in ufw. On some machines it seems that ufw blocks the connection from the status checks (which seems correct) and on some machines (mine) it doesn't, which is why I didn't notice the problem. * The new check that system services are running mistakenly checked that the Dovecot Managesieve service is publicly accessible. Although the service binds to the public network interface we don't open the port in ufw. On some machines it seems that ufw blocks the connection from the status checks (which seems correct) and on some machines (mine) it doesn't, which is why I didn't notice the problem.
* The current backup chain will now try to predict how many days until it is deleted (always at least 3 days after the next full backup). * The current backup chain will now try to predict how many days until it is deleted (always at least 3 days after the next full backup).
* The list of aliases that forward to a user are removed from the Mail Users page because when there are many alises it is slow and times-out.
v0.07 (February 28, 2015) v0.07 (February 28, 2015)
------------------------- -------------------------
......
...@@ -91,10 +91,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False): ...@@ -91,10 +91,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False):
# email: "name@domain.tld", # email: "name@domain.tld",
# privileges: [ "priv1", "priv2", ... ], # privileges: [ "priv1", "priv2", ... ],
# status: "active", # status: "active",
# aliases: [
# ("alias@domain.tld", ["indirect.alias@domain.tld", ...]),
# ...
# ]
# }, # },
# ... # ...
# ] # ]
...@@ -102,9 +98,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False): ...@@ -102,9 +98,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False):
# ... # ...
# ] # ]
# Pre-load all aliases.
aliases = get_mail_alias_map(env)
# Get users and their privileges. # Get users and their privileges.
users = [] users = []
active_accounts = set() active_accounts = set()
...@@ -121,10 +114,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False): ...@@ -121,10 +114,6 @@ def get_mail_users_ex(env, with_archived=False, with_slow_info=False):
users.append(user) users.append(user)
if with_slow_info: if with_slow_info:
user["aliases"] = [
(alias, sorted(evaluate_mail_alias_map(alias, aliases, env)))
for alias in aliases.get(email.lower(), [])
]
user["mailbox_size"] = utils.du(os.path.join(env['STORAGE_ROOT'], 'mail/mailboxes', *reversed(email.split("@")))) user["mailbox_size"] = utils.du(os.path.join(env['STORAGE_ROOT'], 'mail/mailboxes', *reversed(email.split("@"))))
# Add in archived accounts. # Add in archived accounts.
...@@ -230,21 +219,6 @@ def get_mail_aliases_ex(env): ...@@ -230,21 +219,6 @@ def get_mail_aliases_ex(env):
domain["aliases"].sort(key = lambda alias : (alias["required"], alias["source"])) domain["aliases"].sort(key = lambda alias : (alias["required"], alias["source"]))
return domains return domains
def get_mail_alias_map(env):
aliases = { }
for alias, targets in get_mail_aliases(env):
for em in targets.split(","):
em = em.strip().lower()
aliases.setdefault(em, []).append(alias)
return aliases
def evaluate_mail_alias_map(email, aliases, env):
ret = set()
for alias in aliases.get(email.lower(), []):
ret.add(alias)
ret |= evaluate_mail_alias_map(alias, aliases, env)
return ret
def get_domain(emailaddr): def get_domain(emailaddr):
return emailaddr.split('@', 1)[1] return emailaddr.split('@', 1)[1]
......
<h2>Users</h2> <h2>Users</h2>
<style> <style>
#user_table h4 { margin: 1em 0 0 0; }
#user_table tr.account_inactive td.address { color: #888; text-decoration: line-through; } #user_table tr.account_inactive td.address { color: #888; text-decoration: line-through; }
#user_table .aliases { font-size: 90%; }
#user_table .aliases div:before { content: "⇖ "; }
#user_table .aliases div { }
#user_table .actions { margin-top: .33em; font-size: 95%; } #user_table .actions { margin-top: .33em; font-size: 95%; }
#user_table .account_inactive .if_active { display: none; } #user_table .account_inactive .if_active { display: none; }
#user_table .account_active .if_inactive { display: none; } #user_table .account_active .if_inactive { display: none; }
#user_table .account_active.if_inactive { display: none; }
</style> </style>
<h3>Add a mail user</h3> <h3>Add a mail user</h3>
...@@ -77,11 +76,9 @@ ...@@ -77,11 +76,9 @@
<td class='mailboxsize'> <td class='mailboxsize'>
</td> </td>
</tr> </tr>
<tr id="user-extra-template"> <tr id="user-extra-template" class="if_inactive">
<td colspan="3" style="border-top: 0; padding-top: 0"> <td colspan="3" style="border: 0; padding-top: 0">
<div class='if_inactive restore_info' style='color: #888; font-size: 90%'>To restore account, create a new account with this email address. Or to permanently delete the mailbox, delete the directory <tt></tt> on the machine.</div> <div class='restore_info' style='color: #888; font-size: 90%'>To restore account, create a new account with this email address. Or to permanently delete the mailbox, delete the directory <tt></tt> on the machine.</div>
<div class='aliases' style='display: none'> </div>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -98,7 +95,7 @@ function show_users() { ...@@ -98,7 +95,7 @@ function show_users() {
function(r) { function(r) {
$('#user_table tbody').html(""); $('#user_table tbody').html("");
for (var i = 0; i < r.length; i++) { for (var i = 0; i < r.length; i++) {
var hdr = $("<tr><td><h4/></td></tr>"); var hdr = $("<tr><td colspan='3'><h4/></td></tr>");
hdr.find('h4').text(r[i].domain); hdr.find('h4').text(r[i].domain);
$('#user_table tbody').append(hdr); $('#user_table tbody').append(hdr);
...@@ -137,16 +134,6 @@ function show_users() { ...@@ -137,16 +134,6 @@ function show_users() {
p.find('span.name').text(add_privs[j]); p.find('span.name').text(add_privs[j]);
n.find('.add-privs').append(p); n.find('.add-privs').append(p);
} }
if (user.aliases && user.aliases.length > 0) {
n2.find('.aliases').show();
for (var j = 0; j < user.aliases.length; j++) {
n2.find('.aliases').append($("<div/>").text(
user.aliases[j][0]
+ (user.aliases[j][1].length > 0 ? "" + user.aliases[j][1].join(", ") : "")
))
}
}
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment