Fix mailbox info when user not allowed to access to mail

This commit is contained in:
Josué Tille 2019-01-09 22:56:41 +01:00
parent 5a6a85ab07
commit 9109850fb0
No known key found for this signature in database
GPG key ID: D5E068C6DFA8681D
2 changed files with 3 additions and 0 deletions

View file

@ -288,6 +288,7 @@
"mail_alias_remove_failed": "Unable to remove mail alias '{mail:s}'",
"mail_domain_unknown": "Unknown mail address domain '{domain:s}'",
"mail_forward_remove_failed": "Unable to remove mail forward '{mail:s}'",
"mailbox_disabled": "Mailbox disabled for user {user:s}",
"mailbox_used_space_dovecot_down": "Dovecot mailbox service need to be up, if you want to get mailbox used space",
"mail_unavailable": "This email address is reserved and shall be automatically allocated to the very first user",
"maindomain_change_failed": "Unable to change the main domain",

View file

@ -437,6 +437,8 @@ def user_info(auth, username):
if service_status("dovecot")["status"] != "running":
logger.warning(m18n.n('mailbox_used_space_dovecot_down'))
elif not user_permission_list(auth, app="mail", permission="main", username=username)['permissions']:
logger.warning(m18n.n('mailbox_disabled', user=username))
else:
cmd = 'doveadm -f flow quota get -u %s' % user['uid'][0]
cmd_result = subprocess.check_output(cmd, stderr=subprocess.STDOUT,