From 9109850fb06b88c07bf3c493f52d7aad9487a81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 9 Jan 2019 22:56:41 +0100 Subject: [PATCH] Fix mailbox info when user not allowed to access to mail --- locales/en.json | 1 + src/yunohost/user.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/locales/en.json b/locales/en.json index 45c1fbb90..6ab780feb 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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", diff --git a/src/yunohost/user.py b/src/yunohost/user.py index b800c9b0e..5e58909f7 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -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,